author | mickeyl <mickeyl> | 2003-05-04 20:40:28 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-04 20:40:28 (UTC) |
commit | 7372d0271b19bc6ead8e796a949746ae45fe13fa (patch) (unidiff) | |
tree | 35f2e418dfc4184ae335f24a487bce5a6787f129 | |
parent | 09dceae91b14a4b2d936ebfc6c7c276686c2b98c (diff) | |
download | opie-7372d0271b19bc6ead8e796a949746ae45fe13fa.zip opie-7372d0271b19bc6ead8e796a949746ae45fe13fa.tar.gz opie-7372d0271b19bc6ead8e796a949746ae45fe13fa.tar.bz2 |
- cleanup and code refactoring towards 1.0
- match IP addresses to MAC addresses by looking @ ARP packets
- show IP addresses
- reduce debug output
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 18 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.h | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 98 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 186 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 7 |
8 files changed, 222 insertions, 106 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 927f4b7..62e1d9a 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -1,47 +1,65 @@ | |||
1 | MOC_DIR = ./tmp | 1 | MOC_DIR = ./tmp |
2 | OBJECTS_DIR = ./tmp | 2 | OBJECTS_DIR = ./tmp |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | TEMPLATE = app | 4 | TEMPLATE = app |
5 | CONFIG = qt warn_on debug | 5 | CONFIG = qt warn_on debug |
6 | 6 | ||
7 | HEADERS = wellenreiterbase.h \ | 7 | HEADERS = wellenreiterbase.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | wellenreiter.h \ | 9 | wellenreiter.h \ |
10 | scanlist.h \ | 10 | scanlist.h \ |
11 | logwindow.h \ | 11 | logwindow.h \ |
12 | hexwindow.h \ | 12 | hexwindow.h \ |
13 | statwindow.h \ | 13 | statwindow.h \ |
14 | configwindow.h \ | 14 | configwindow.h \ |
15 | manufacturers.h \ | 15 | manufacturers.h \ |
16 | graphwindow.h | 16 | graphwindow.h |
17 | 17 | ||
18 | SOURCES = main.cpp \ | 18 | SOURCES = main.cpp \ |
19 | mainwindow.cpp \ | 19 | mainwindow.cpp \ |
20 | wellenreiterbase.cpp \ | 20 | wellenreiterbase.cpp \ |
21 | wellenreiter.cpp \ | 21 | wellenreiter.cpp \ |
22 | scanlist.cpp \ | 22 | scanlist.cpp \ |
23 | logwindow.cpp \ | 23 | logwindow.cpp \ |
24 | hexwindow.cpp \ | 24 | hexwindow.cpp \ |
25 | statwindow.cpp \ | 25 | statwindow.cpp \ |
26 | configwindow.cpp \ | 26 | configwindow.cpp \ |
27 | manufacturers.cpp \ | 27 | manufacturers.cpp \ |
28 | graphwindow.cpp | 28 | graphwindow.cpp |
29 | 29 | ||
30 | INCLUDEPATH += $(OPIEDIR)/include | 30 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH += $(OPIEDIR)/include | 31 | DEPENDPATH += $(OPIEDIR)/include |
32 | INTERFACES = configbase.ui | 32 | INTERFACES = configbase.ui |
33 | TARGET = wellenreiter | 33 | TARGET = wellenreiter |
34 | 34 | ||
35 | !contains( platform, x11 ) { | 35 | !contains( platform, x11 ) { |
36 | message( qws ) | 36 | message( qws ) |
37 | include ( $(OPIEDIR)/include.pro ) | 37 | include ( $(OPIEDIR)/include.pro ) |
38 | LIBS += -lqpe -lopie -lopiecore2 -lopieui2 -lopienet2 -lstdc++ | 38 | LIBS += -lqpe -lopie -lopiecore2 -lopieui2 -lopienet2 -lstdc++ |
39 | } | 39 | } |
40 | 40 | ||
41 | contains( platform, x11 ) { | 41 | contains( platform, x11 ) { |
42 | LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter | 42 | LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter |
43 | SOURCES += resource.cpp | 43 | SOURCES += resource.cpp |
44 | HEADERS += resource.h | 44 | HEADERS += resource.h |
45 | DESTDIR = $(OPIEDIR)/output/bin | 45 | DESTDIR = $(OPIEDIR)/output/bin |
46 | } | 46 | } |
47 | 47 | ||
48 | TRANSLATIONS = ../../../../i18n/de/wellenreiter.ts \ | ||
49 | ../../../../i18n/nl/wellenreiter.ts \ | ||
50 | ../../../../i18n/da/wellenreiter.ts \ | ||
51 | ../../../../i18n/xx/wellenreiter.ts \ | ||
52 | ../../../../i18n/en/wellenreiter.ts \ | ||
53 | ../../../../i18n/es/wellenreiter.ts \ | ||
54 | ../../../../i18n/fr/wellenreiter.ts \ | ||
55 | ../../../../i18n/hu/wellenreiter.ts \ | ||
56 | ../../../../i18n/ja/wellenreiter.ts \ | ||
57 | ../../../../i18n/ko/wellenreiter.ts \ | ||
58 | ../../../../i18n/no/wellenreiter.ts \ | ||
59 | ../../../../i18n/pl/wellenreiter.ts \ | ||
60 | ../../../../i18n/pt/wellenreiter.ts \ | ||
61 | ../../../../i18n/pt_BR/wellenreiter.ts \ | ||
62 | ../../../../i18n/sl/wellenreiter.ts \ | ||
63 | ../../../../i18n/zh_CN/wellenreiter.ts \ | ||
64 | ../../../../i18n/zh_TW/wellenreiter.ts | ||
65 | |||
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 12f74fd..6078fa2 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp | |||
@@ -1,50 +1,54 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "logwindow.h" | 16 | #include "logwindow.h" |
17 | #include <qmultilineedit.h> | 17 | #include <qmultilineedit.h> |
18 | #include <qdatetime.h> | 18 | #include <qdatetime.h> |
19 | 19 | ||
20 | MLogWindow* MLogWindow::_instance; | ||
21 | |||
20 | MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) | 22 | MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) |
21 | :QVBox( parent, name, f ) | 23 | :QVBox( parent, name, f ) |
22 | { | 24 | { |
23 | ledit = new QMultiLineEdit( this ); | 25 | ledit = new QMultiLineEdit( this ); |
24 | ledit->setReadOnly( true ); | 26 | ledit->setReadOnly( true ); |
27 | |||
28 | MLogWindow::_instance = this; | ||
25 | } | 29 | } |
26 | 30 | ||
27 | 31 | ||
28 | void MLogWindow::log( QString text ) | 32 | void MLogWindow::log( QString text ) |
29 | { | 33 | { |
30 | QTime time = QTime::currentTime(); | 34 | QTime time = QTime::currentTime(); |
31 | QString line; | 35 | QString line; |
32 | line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); | 36 | line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); |
33 | int col; | 37 | int col; |
34 | int row; | 38 | int row; |
35 | ledit->getCursorPosition( &col, &row ); | 39 | ledit->getCursorPosition( &col, &row ); |
36 | ledit->insertAt( line, col, row ); | 40 | ledit->insertAt( line, col, row ); |
37 | qDebug( line ); | 41 | qDebug( line ); |
38 | } | 42 | } |
39 | 43 | ||
40 | 44 | ||
41 | void MLogWindow::clear() | 45 | void MLogWindow::clear() |
42 | { | 46 | { |
43 | ledit->clear(); | 47 | ledit->clear(); |
44 | } | 48 | } |
45 | 49 | ||
46 | 50 | ||
47 | const QString MLogWindow::getLog() const | 51 | const QString MLogWindow::getLog() const |
48 | { | 52 | { |
49 | return ledit->text(); | 53 | return ledit->text(); |
50 | } | 54 | } |
diff --git a/noncore/net/wellenreiter/gui/logwindow.h b/noncore/net/wellenreiter/gui/logwindow.h index 6e0fe50..da8c274 100644 --- a/noncore/net/wellenreiter/gui/logwindow.h +++ b/noncore/net/wellenreiter/gui/logwindow.h | |||
@@ -1,40 +1,45 @@ | |||
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 LOGWINDOW_H | 16 | #ifndef LOGWINDOW_H |
17 | #define LOGWINDOW_H | 17 | #define LOGWINDOW_H |
18 | 18 | ||
19 | #include <qvbox.h> | 19 | #include <qvbox.h> |
20 | 20 | ||
21 | class QString; | 21 | class QString; |
22 | class QMultiLineEdit; | 22 | class QMultiLineEdit; |
23 | 23 | ||
24 | class MLogWindow: public QVBox | 24 | class MLogWindow: public QVBox |
25 | { | 25 | { |
26 | 26 | ||
27 | public: | 27 | public: |
28 | MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 ); | 28 | MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 ); |
29 | 29 | ||
30 | void log( QString text ); | 30 | void log( QString text ); |
31 | const QString getLog() const; | 31 | const QString getLog() const; |
32 | void clear(); | 32 | void clear(); |
33 | 33 | ||
34 | static MLogWindow* logwindow() { return MLogWindow::_instance; }; | ||
35 | |||
34 | protected: | 36 | protected: |
35 | QMultiLineEdit* ledit; | 37 | QMultiLineEdit* ledit; |
36 | 38 | ||
39 | private: | ||
40 | static MLogWindow* _instance; | ||
41 | |||
37 | }; | 42 | }; |
38 | 43 | ||
39 | #endif | 44 | #endif |
40 | 45 | ||
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index c4a8fbc..773d825 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,362 +1,362 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include "logwindow.h" | 17 | #include "logwindow.h" |
18 | #include "hexwindow.h" | 18 | #include "hexwindow.h" |
19 | #include "mainwindow.h" | 19 | #include "mainwindow.h" |
20 | #include "wellenreiter.h" | 20 | #include "wellenreiter.h" |
21 | #include "scanlist.h" | 21 | #include "scanlist.h" |
22 | 22 | ||
23 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qdatastream.h> | 24 | #include <qdatastream.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
27 | #include <qiconset.h> | 27 | #include <qiconset.h> |
28 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
31 | #include <qstatusbar.h> | 31 | #include <qstatusbar.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtoolbutton.h> | 33 | #include <qtoolbutton.h> |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <opie/ofiledialog.h> | 37 | #include <opie/ofiledialog.h> |
38 | #else | 38 | #else |
39 | #include "resource.h" | 39 | #include "resource.h" |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <qfiledialog.h> | 41 | #include <qfiledialog.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 44 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
45 | :QMainWindow( parent, name, f ) | 45 | :QMainWindow( parent, name, f ) |
46 | { | 46 | { |
47 | cw = new WellenreiterConfigWindow( this ); | 47 | cw = new WellenreiterConfigWindow( this ); |
48 | mw = new Wellenreiter( this ); | 48 | mw = new Wellenreiter( this ); |
49 | mw->setConfigWindow( cw ); | 49 | mw->setConfigWindow( cw ); |
50 | setCentralWidget( mw ); | 50 | setCentralWidget( mw ); |
51 | 51 | ||
52 | // setup application icon | 52 | // setup application icon |
53 | 53 | ||
54 | #ifndef QWS | 54 | #ifndef QWS |
55 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 55 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
56 | setIconText( "Wellenreiter/X11" ); | 56 | setIconText( "Wellenreiter/X11" ); |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | // setup icon sets | 59 | // setup icon sets |
60 | 60 | ||
61 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 61 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
63 | startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 63 | startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
64 | stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 64 | stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
65 | 65 | ||
66 | // setup tool buttons | 66 | // setup tool buttons |
67 | 67 | ||
68 | startButton = new QToolButton( 0 ); | 68 | startButton = new QToolButton( 0 ); |
69 | #ifdef QWS | 69 | #ifdef QWS |
70 | startButton->setAutoRaise( true ); | 70 | startButton->setAutoRaise( true ); |
71 | #endif | 71 | #endif |
72 | startButton->setIconSet( *startIconSet ); | 72 | startButton->setIconSet( *startIconSet ); |
73 | startButton->setEnabled( false ); | 73 | startButton->setEnabled( false ); |
74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | 74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); |
75 | 75 | ||
76 | stopButton = new QToolButton( 0 ); | 76 | stopButton = new QToolButton( 0 ); |
77 | #ifdef QWS | 77 | #ifdef QWS |
78 | stopButton->setAutoRaise( true ); | 78 | stopButton->setAutoRaise( true ); |
79 | #endif | 79 | #endif |
80 | stopButton->setIconSet( *stopIconSet ); | 80 | stopButton->setIconSet( *stopIconSet ); |
81 | stopButton->setEnabled( false ); | 81 | stopButton->setEnabled( false ); |
82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); | 82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
83 | 83 | ||
84 | QToolButton* c = new QToolButton( 0 ); | 84 | QToolButton* c = new QToolButton( 0 ); |
85 | #ifdef QWS | 85 | #ifdef QWS |
86 | c->setAutoRaise( true ); | 86 | c->setAutoRaise( true ); |
87 | #endif | 87 | #endif |
88 | c->setIconSet( *infoIconSet ); | 88 | c->setIconSet( *infoIconSet ); |
89 | c->setEnabled( false ); | 89 | c->setEnabled( false ); |
90 | 90 | ||
91 | QToolButton* d = new QToolButton( 0 ); | 91 | QToolButton* d = new QToolButton( 0 ); |
92 | #ifdef QWS | 92 | #ifdef QWS |
93 | d->setAutoRaise( true ); | 93 | d->setAutoRaise( true ); |
94 | #endif | 94 | #endif |
95 | d->setIconSet( *settingsIconSet ); | 95 | d->setIconSet( *settingsIconSet ); |
96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
97 | 97 | ||
98 | // setup menu bar | 98 | // setup menu bar |
99 | 99 | ||
100 | int id; | 100 | int id; |
101 | 101 | ||
102 | QMenuBar* mb = menuBar(); | 102 | QMenuBar* mb = menuBar(); |
103 | 103 | ||
104 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 104 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
105 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); | 105 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); |
106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); | 106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); |
107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); | 107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); |
108 | 108 | ||
109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
110 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); | 110 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); |
111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
112 | 112 | ||
113 | QPopupMenu* file = new QPopupMenu( mb ); | 113 | QPopupMenu* file = new QPopupMenu( mb ); |
114 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); | 114 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
115 | id = file->insertItem( tr( "&Load" ), fileLoad ); | 115 | id = file->insertItem( tr( "&Load" ), fileLoad ); |
116 | file->insertItem( tr( "&Save" ), fileSave ); | 116 | file->insertItem( tr( "&Save" ), fileSave ); |
117 | file->insertSeparator(); | 117 | file->insertSeparator(); |
118 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); | 118 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
119 | 119 | ||
120 | QPopupMenu* view = new QPopupMenu( mb ); | 120 | QPopupMenu* view = new QPopupMenu( mb ); |
121 | view->insertItem( tr( "&Configure..." ) ); | 121 | view->insertItem( tr( "&Configure..." ) ); |
122 | 122 | ||
123 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 123 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
124 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); | 124 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
125 | sniffer->insertSeparator(); | 125 | sniffer->insertSeparator(); |
126 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); | 126 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
127 | sniffer->setItemEnabled( startID, false ); | 127 | sniffer->setItemEnabled( startID, false ); |
128 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); | 128 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
129 | sniffer->setItemEnabled( stopID, false ); | 129 | sniffer->setItemEnabled( stopID, false ); |
130 | 130 | ||
131 | QPopupMenu* demo = new QPopupMenu( mb ); | 131 | QPopupMenu* demo = new QPopupMenu( mb ); |
132 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); | 132 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
133 | 133 | ||
134 | id = mb->insertItem( tr( "&File" ), file ); | 134 | id = mb->insertItem( tr( "&File" ), file ); |
135 | id = mb->insertItem( tr( "&View" ), view ); | 135 | //id = mb->insertItem( tr( "&View" ), view ); |
136 | mb->setItemEnabled( id, false ); | 136 | //mb->setItemEnabled( id, false ); |
137 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 137 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
138 | id = mb->insertItem( tr( "&Demo" ), demo ); | 138 | //id = mb->insertItem( tr( "&Demo" ), demo ); |
139 | mb->setItemEnabled( id, true ); | 139 | //mb->setItemEnabled( id, true ); |
140 | 140 | ||
141 | #ifdef QWS | 141 | #ifdef QWS |
142 | mb->insertItem( startButton ); | 142 | mb->insertItem( startButton ); |
143 | mb->insertItem( stopButton ); | 143 | mb->insertItem( stopButton ); |
144 | mb->insertItem( c ); | 144 | mb->insertItem( c ); |
145 | mb->insertItem( d ); | 145 | mb->insertItem( d ); |
146 | #else // Qt3 changed the insertion order. It's now totally random :( | 146 | #else // Qt3 changed the insertion order. It's now totally random :( |
147 | mb->insertItem( d ); | 147 | mb->insertItem( d ); |
148 | mb->insertItem( c ); | 148 | mb->insertItem( c ); |
149 | mb->insertItem( stopButton ); | 149 | mb->insertItem( stopButton ); |
150 | mb->insertItem( startButton ); | 150 | mb->insertItem( startButton ); |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | updateToolButtonState(); | 153 | updateToolButtonState(); |
154 | 154 | ||
155 | // setup status bar (for now only on X11) | 155 | // setup status bar (for now only on X11) |
156 | 156 | ||
157 | #ifndef QWS | 157 | #ifndef QWS |
158 | statusBar()->message( tr( "Ready." ) ); | 158 | statusBar()->message( tr( "Ready." ) ); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
163 | }; | 163 | }; |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | void WellenreiterMainWindow::showConfigure() | 167 | void WellenreiterMainWindow::showConfigure() |
168 | { | 168 | { |
169 | qDebug( "show configure..." ); | 169 | qDebug( "show configure..." ); |
170 | cw->setCaption( tr( "Configure" ) ); | 170 | cw->setCaption( tr( "Configure" ) ); |
171 | #ifdef QWS | 171 | #ifdef QWS |
172 | cw->showMaximized(); | 172 | cw->showMaximized(); |
173 | #endif | 173 | #endif |
174 | int result = cw->exec(); | 174 | int result = cw->exec(); |
175 | 175 | ||
176 | if ( result ) updateToolButtonState(); | 176 | if ( result ) updateToolButtonState(); |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | 180 | ||
181 | void WellenreiterMainWindow::updateToolButtonState() | 181 | void WellenreiterMainWindow::updateToolButtonState() |
182 | { | 182 | { |
183 | const QString& interface = cw->interfaceName->currentText(); | 183 | const QString& interface = cw->interfaceName->currentText(); |
184 | const int cardtype = cw->daemonDeviceType(); | 184 | const int cardtype = cw->daemonDeviceType(); |
185 | const int interval = cw->daemonHopInterval(); | 185 | const int interval = cw->daemonHopInterval(); |
186 | 186 | ||
187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
188 | { | 188 | { |
189 | startButton->setEnabled( true ); | 189 | startButton->setEnabled( true ); |
190 | menuBar()->setItemEnabled( startID, true ); | 190 | menuBar()->setItemEnabled( startID, true ); |
191 | } | 191 | } |
192 | else | 192 | else |
193 | { | 193 | { |
194 | startButton->setEnabled( false ); | 194 | startButton->setEnabled( false ); |
195 | menuBar()->setItemEnabled( startID, false ); | 195 | menuBar()->setItemEnabled( startID, false ); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
200 | void WellenreiterMainWindow::changedSniffingState() | 200 | void WellenreiterMainWindow::changedSniffingState() |
201 | { | 201 | { |
202 | startButton->setEnabled( !mw->sniffing ); | 202 | startButton->setEnabled( !mw->sniffing ); |
203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
204 | stopButton->setEnabled( mw->sniffing ); | 204 | stopButton->setEnabled( mw->sniffing ); |
205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | WellenreiterMainWindow::~WellenreiterMainWindow() | 209 | WellenreiterMainWindow::~WellenreiterMainWindow() |
210 | { | 210 | { |
211 | delete infoIconSet; | 211 | delete infoIconSet; |
212 | delete settingsIconSet; | 212 | delete settingsIconSet; |
213 | delete startIconSet; | 213 | delete startIconSet; |
214 | delete stopIconSet; | 214 | delete stopIconSet; |
215 | }; | 215 | }; |
216 | 216 | ||
217 | void WellenreiterMainWindow::demoAddStations() | 217 | void WellenreiterMainWindow::demoAddStations() |
218 | { | 218 | { |
219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); | 220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); | 221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); | 222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); | 223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | QString WellenreiterMainWindow::getFileName( bool save ) | 227 | QString WellenreiterMainWindow::getFileName( bool save ) |
228 | { | 228 | { |
229 | QMap<QString, QStringList> map; | 229 | QMap<QString, QStringList> map; |
230 | map.insert( tr("All"), QStringList() ); | 230 | map.insert( tr("All"), QStringList() ); |
231 | QStringList text; | 231 | QStringList text; |
232 | text << "text/*"; | 232 | text << "text/*"; |
233 | map.insert( tr("Text"), text ); | 233 | map.insert( tr("Text"), text ); |
234 | text << "*"; | 234 | text << "*"; |
235 | map.insert( tr("All"), text ); | 235 | map.insert( tr("All"), text ); |
236 | 236 | ||
237 | QString str; | 237 | QString str; |
238 | if ( save ) | 238 | if ( save ) |
239 | { | 239 | { |
240 | #ifdef QWS | 240 | #ifdef QWS |
241 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); | 241 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
242 | #else | 242 | #else |
243 | str = QFileDialog::getSaveFileName(); | 243 | str = QFileDialog::getSaveFileName(); |
244 | #endif | 244 | #endif |
245 | if ( str.isEmpty() || QFileInfo(str).isDir() ) | 245 | if ( str.isEmpty() || QFileInfo(str).isDir() ) |
246 | return ""; | 246 | return ""; |
247 | } | 247 | } |
248 | else | 248 | else |
249 | { | 249 | { |
250 | #ifdef QWS | 250 | #ifdef QWS |
251 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); | 251 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); |
252 | #else | 252 | #else |
253 | str = QFileDialog::getOpenFileName(); | 253 | str = QFileDialog::getOpenFileName(); |
254 | #endif | 254 | #endif |
255 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) | 255 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) |
256 | return ""; | 256 | return ""; |
257 | } | 257 | } |
258 | return str; | 258 | return str; |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | void WellenreiterMainWindow::fileSaveLog() | 262 | void WellenreiterMainWindow::fileSaveLog() |
263 | { | 263 | { |
264 | QString fname = getFileName( true ); | 264 | QString fname = getFileName( true ); |
265 | if ( !fname.isEmpty() ) | 265 | if ( !fname.isEmpty() ) |
266 | { | 266 | { |
267 | QFile f( fname ); | 267 | QFile f( fname ); |
268 | if ( f.open(IO_WriteOnly) ) | 268 | if ( f.open(IO_WriteOnly) ) |
269 | { | 269 | { |
270 | QTextStream t( &f ); | 270 | QTextStream t( &f ); |
271 | t << mw->logWindow()->getLog(); | 271 | t << mw->logWindow()->getLog(); |
272 | f.close(); | 272 | f.close(); |
273 | qDebug( "Saved log to file '%s'", (const char*) fname ); | 273 | qDebug( "Saved log to file '%s'", (const char*) fname ); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | 277 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | void WellenreiterMainWindow::fileSaveSession() | 282 | void WellenreiterMainWindow::fileSaveSession() |
283 | { | 283 | { |
284 | QString fname = getFileName( true ); | 284 | QString fname = getFileName( true ); |
285 | if ( !fname.isEmpty() ) | 285 | if ( !fname.isEmpty() ) |
286 | { | 286 | { |
287 | 287 | ||
288 | QFile f( fname ); | 288 | QFile f( fname ); |
289 | if ( f.open(IO_WriteOnly) ) | 289 | if ( f.open(IO_WriteOnly) ) |
290 | { | 290 | { |
291 | QDataStream t( &f ); | 291 | QDataStream t( &f ); |
292 | t << *mw->netView(); | 292 | t << *mw->netView(); |
293 | f.close(); | 293 | f.close(); |
294 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 294 | qDebug( "Saved session to file '%s'", (const char*) fname ); |
295 | } | 295 | } |
296 | else | 296 | else |
297 | { | 297 | { |
298 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | 298 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void WellenreiterMainWindow::fileSaveHex() | 303 | void WellenreiterMainWindow::fileSaveHex() |
304 | { | 304 | { |
305 | QString fname = getFileName( true ); | 305 | QString fname = getFileName( true ); |
306 | if ( !fname.isEmpty() ) | 306 | if ( !fname.isEmpty() ) |
307 | { | 307 | { |
308 | QFile f( fname ); | 308 | QFile f( fname ); |
309 | if ( f.open(IO_WriteOnly) ) | 309 | if ( f.open(IO_WriteOnly) ) |
310 | { | 310 | { |
311 | QTextStream t( &f ); | 311 | QTextStream t( &f ); |
312 | t << mw->hexWindow()->getLog(); | 312 | t << mw->hexWindow()->getLog(); |
313 | f.close(); | 313 | f.close(); |
314 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); | 314 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); |
315 | } | 315 | } |
316 | else | 316 | else |
317 | { | 317 | { |
318 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); | 318 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | void WellenreiterMainWindow::fileLoadSession() | 323 | void WellenreiterMainWindow::fileLoadSession() |
324 | { | 324 | { |
325 | QString fname = getFileName( false ); | 325 | QString fname = getFileName( false ); |
326 | if ( !fname.isEmpty() ) | 326 | if ( !fname.isEmpty() ) |
327 | { | 327 | { |
328 | QFile f( fname ); | 328 | QFile f( fname ); |
329 | if ( f.open(IO_ReadOnly) ) | 329 | if ( f.open(IO_ReadOnly) ) |
330 | { | 330 | { |
331 | QDataStream t( &f ); | 331 | QDataStream t( &f ); |
332 | t >> *mw->netView(); | 332 | t >> *mw->netView(); |
333 | f.close(); | 333 | f.close(); |
334 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 334 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
335 | } | 335 | } |
336 | else | 336 | else |
337 | { | 337 | { |
338 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 338 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | void WellenreiterMainWindow::fileNew() | 343 | void WellenreiterMainWindow::fileNew() |
344 | { | 344 | { |
345 | mw->netView()->clear(); | 345 | mw->netView()->clear(); |
346 | mw->logWindow()->clear(); | 346 | mw->logWindow()->clear(); |
347 | mw->hexWindow()->clear(); | 347 | mw->hexWindow()->clear(); |
348 | } | 348 | } |
349 | 349 | ||
350 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 350 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
351 | { | 351 | { |
352 | if ( mw->isDaemonRunning() ) | 352 | if ( mw->isDaemonRunning() ) |
353 | { | 353 | { |
354 | QMessageBox::warning( this, "Wellenreiter/Opie", | 354 | QMessageBox::warning( this, "Wellenreiter/Opie", |
355 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); | 355 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); |
356 | e->ignore(); | 356 | e->ignore(); |
357 | } | 357 | } |
358 | else | 358 | else |
359 | { | 359 | { |
360 | QMainWindow::closeEvent( e ); | 360 | QMainWindow::closeEvent( e ); |
361 | } | 361 | } |
362 | } | 362 | } |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 3a6aa15..d5665b4 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -1,408 +1,456 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "logwindow.h" | ||
18 | 19 | ||
19 | #include <assert.h> | 20 | #include <assert.h> |
20 | #include "manufacturers.h" | 21 | #include "manufacturers.h" |
21 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
22 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
23 | 24 | ||
24 | #ifdef QWS | 25 | #ifdef QWS |
25 | #include <opie/odevice.h> | 26 | #include <opie/odevice.h> |
26 | using namespace Opie; | 27 | using namespace Opie; |
27 | #endif | 28 | #endif |
28 | 29 | ||
29 | 30 | ||
30 | #ifdef QWS | 31 | #ifdef QWS |
31 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
32 | #else | 33 | #else |
33 | #include "resource.h" | 34 | #include "resource.h" |
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | const int col_type = 0; | 37 | const int col_type = 0; |
37 | const int col_essid = 0; | 38 | const int col_essid = 0; |
38 | const int col_sig = 1; | 39 | const int col_sig = 1; |
39 | const int col_ap = 2; | 40 | const int col_ap = 2; |
40 | const int col_channel = 3; | 41 | const int col_channel = 3; |
41 | const int col_wep = 4; | 42 | const int col_wep = 4; |
42 | const int col_traffic = 5; | 43 | const int col_traffic = 5; |
43 | const int col_manuf = 6; | 44 | const int col_ip = 6; |
44 | const int col_firstseen = 7; | 45 | const int col_manuf = 7; |
45 | const int col_lastseen = 8; | 46 | const int col_firstseen = 8; |
47 | const int col_lastseen = 9; | ||
46 | 48 | ||
47 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 49 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
48 | :OListView( parent, name ), _manufacturerdb( 0 ) | 50 | :OListView( parent, name ), _manufacturerdb( 0 ) |
49 | { | 51 | { |
50 | 52 | ||
51 | setFrameShape( QListView::StyledPanel ); | 53 | setFrameShape( QListView::StyledPanel ); |
52 | setFrameShadow( QListView::Sunken ); | 54 | setFrameShadow( QListView::Sunken ); |
53 | 55 | ||
54 | addColumn( tr( "Net/Station" ) ); | 56 | addColumn( tr( "Net/Station" ) ); |
55 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); | 57 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
56 | addColumn( tr( "#" ) ); | 58 | addColumn( tr( "#" ) ); |
57 | setColumnAlignment( 1, AlignCenter ); | 59 | setColumnAlignment( col_sig, AlignCenter ); |
58 | addColumn( tr( "MAC" ) ); | 60 | addColumn( tr( "MAC" ) ); |
59 | setColumnAlignment( 2, AlignCenter ); | 61 | setColumnAlignment( col_ap, AlignCenter ); |
60 | addColumn( tr( "Chn" ) ); | 62 | addColumn( tr( "Chn" ) ); |
61 | setColumnAlignment( 3, AlignCenter ); | 63 | setColumnAlignment( col_channel, AlignCenter ); |
62 | addColumn( tr( "W" ) ); | 64 | addColumn( tr( "W" ) ); |
63 | setColumnAlignment( 4, AlignCenter ); | 65 | setColumnAlignment( col_wep, AlignCenter ); |
64 | addColumn( tr( "T" ) ); | 66 | addColumn( tr( "T" ) ); |
65 | setColumnAlignment( 5, AlignCenter ); | 67 | setColumnAlignment( col_traffic, AlignCenter ); |
68 | addColumn( tr( "IP" ) ); | ||
69 | setColumnAlignment( col_ip, AlignCenter ); | ||
66 | addColumn( tr( "Manufacturer" ) ); | 70 | addColumn( tr( "Manufacturer" ) ); |
67 | setColumnAlignment( 6, AlignCenter ); | 71 | setColumnAlignment( col_manuf, AlignCenter ); |
68 | addColumn( tr( "First Seen" ) ); | 72 | addColumn( tr( "First Seen" ) ); |
69 | setColumnAlignment( 7, AlignCenter ); | 73 | setColumnAlignment( col_firstseen, AlignCenter ); |
70 | addColumn( tr( "Last Seen" ) ); | 74 | addColumn( tr( "Last Seen" ) ); |
71 | setColumnAlignment( 8, AlignCenter ); | 75 | setColumnAlignment( col_lastseen, AlignCenter ); |
72 | setRootIsDecorated( true ); | 76 | setRootIsDecorated( true ); |
73 | setAllColumnsShowFocus( true ); | 77 | setAllColumnsShowFocus( true ); |
74 | }; | 78 | }; |
75 | 79 | ||
76 | MScanListView::~MScanListView() | 80 | MScanListView::~MScanListView() |
77 | { | 81 | { |
78 | }; | 82 | }; |
79 | 83 | ||
80 | OListViewItem* MScanListView::childFactory() | 84 | OListViewItem* MScanListView::childFactory() |
81 | { | 85 | { |
82 | return new MScanListItem( this ); | 86 | return new MScanListItem( this ); |
83 | } | 87 | } |
84 | 88 | ||
85 | void MScanListView::serializeTo( QDataStream& s) const | 89 | void MScanListView::serializeTo( QDataStream& s) const |
86 | { | 90 | { |
87 | qDebug( "serializing MScanListView" ); | 91 | qDebug( "serializing MScanListView" ); |
88 | OListView::serializeTo( s ); | 92 | OListView::serializeTo( s ); |
89 | } | 93 | } |
90 | 94 | ||
91 | void MScanListView::serializeFrom( QDataStream& s) | 95 | void MScanListView::serializeFrom( QDataStream& s) |
92 | { | 96 | { |
93 | qDebug( "serializing MScanListView" ); | 97 | qDebug( "serializing MScanListView" ); |
94 | OListView::serializeFrom( s ); | 98 | OListView::serializeFrom( s ); |
95 | } | 99 | } |
96 | 100 | ||
97 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) | 101 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) |
98 | { | 102 | { |
99 | _manufacturerdb = manufacturerdb; | 103 | _manufacturerdb = manufacturerdb; |
100 | } | 104 | } |
101 | 105 | ||
102 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 106 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
103 | { | 107 | { |
104 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) | 108 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) |
105 | 109 | ||
106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", | 110 | #ifdef DEBUG |
107 | (const char*) type, | 111 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, |
108 | (const char*) essid, | 112 | (const char*) essid, (const char*) macaddr, channel ); |
109 | (const char*) macaddr, | 113 | #endif |
110 | channel ); | ||
111 | 114 | ||
112 | // search, if we already have seen this net | 115 | // search, if we already have seen this net |
113 | 116 | ||
114 | QString s; | 117 | QString s; |
115 | MScanListItem* network; | 118 | MScanListItem* network; |
116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 119 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
117 | 120 | ||
118 | while ( item && ( item->text( col_essid ) != essid ) ) | 121 | while ( item && ( item->text( col_essid ) != essid ) ) |
119 | { | 122 | { |
123 | #ifdef DEBUG | ||
120 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); | 124 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); |
125 | #endif | ||
121 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 126 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
122 | } | 127 | } |
123 | if ( item ) | 128 | if ( item ) |
124 | { | 129 | { |
125 | // we have already seen this net, check all childs if MAC exists | 130 | // we have already seen this net, check all childs if MAC exists |
126 | 131 | ||
127 | network = item; | 132 | network = item; |
128 | 133 | ||
129 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 134 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
130 | assert( item ); // this shouldn't fail | 135 | assert( item ); // this shouldn't fail |
131 | 136 | ||
132 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 137 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
133 | { | 138 | { |
139 | #ifdef DEBUG | ||
134 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); | 140 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); |
141 | #endif | ||
135 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 142 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
136 | } | 143 | } |
137 | 144 | ||
138 | if ( item ) | 145 | if ( item ) |
139 | { | 146 | { |
140 | // we have already seen this item, it's a dupe | 147 | // we have already seen this item, it's a dupe |
141 | #ifdef DEBUG | 148 | #ifdef DEBUG |
142 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 149 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
143 | #endif | 150 | #endif |
144 | item->receivedBeacon(); | 151 | item->receivedBeacon(); |
145 | return; | 152 | return; |
146 | } | 153 | } |
147 | } | 154 | } |
148 | else | 155 | else |
149 | { | 156 | { |
150 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 157 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
151 | //TODO send s to logwindow | 158 | MLogWindow::logwindow()->log( s ); |
152 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); | 159 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); |
153 | } | 160 | } |
154 | 161 | ||
155 | 162 | ||
156 | // insert new station as child from network | 163 | // insert new station as child from network |
157 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 164 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
158 | 165 | ||
166 | #ifdef DEBUG | ||
159 | qDebug( "inserting new station %s", (const char*) macaddr ); | 167 | qDebug( "inserting new station %s", (const char*) macaddr ); |
168 | #endif | ||
160 | 169 | ||
161 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 170 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
162 | if ( _manufacturerdb ) | 171 | if ( _manufacturerdb ) |
163 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); | 172 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); |
164 | 173 | ||
165 | if ( type == "managed" ) | 174 | if ( type == "managed" ) |
166 | { | 175 | { |
167 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); | 176 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
168 | } | 177 | } |
169 | else | 178 | else |
170 | { | 179 | { |
171 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 180 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
172 | } | 181 | } |
173 | //TODO send s to logwindow | 182 | MLogWindow::logwindow()->log( s ); |
174 | 183 | ||
175 | } | 184 | } |
176 | 185 | ||
177 | 186 | ||
178 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type ) | 187 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type ) |
179 | { | 188 | { |
180 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 189 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
181 | 190 | ||
182 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) | 191 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) |
183 | { | 192 | { |
193 | #ifdef DEBUG | ||
184 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 194 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
195 | #endif | ||
185 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 196 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
186 | } | 197 | } |
187 | 198 | ||
188 | if ( subitem ) | 199 | if ( subitem ) |
189 | { | 200 | { |
190 | // we have already seen this item, it's a dupe | 201 | // we have already seen this item, it's a dupe |
191 | #ifdef DEBUG | 202 | #ifdef DEBUG |
192 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); | 203 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); |
193 | #endif | 204 | #endif |
194 | subitem->receivedBeacon(); //FIXME: sent data bit | 205 | subitem->receivedBeacon(); //FIXME: sent data bit |
195 | return; | 206 | return; |
196 | } | 207 | } |
197 | 208 | ||
198 | // Hey, it seems to be a new item :-D | 209 | // Hey, it seems to be a new item :-D |
199 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 ); | 210 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 ); |
200 | if ( _manufacturerdb ) | 211 | if ( _manufacturerdb ) |
201 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); | 212 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); |
202 | 213 | ||
203 | QString s; | 214 | QString s; |
204 | if ( type == "station" ) | 215 | if ( type == "station" ) |
205 | { | 216 | { |
206 | s.sprintf( "(i) new station in '%s' [??]", (const char*) network->text( col_essid ) ); | 217 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
207 | } | 218 | } |
208 | else | 219 | else |
209 | { | 220 | { |
210 | s.sprintf( "(i) new wireless station in '%s' [??]", (const char*) network->text( col_essid ) ); | 221 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
211 | } | 222 | } |
212 | //TODO send s to logwindow | 223 | MLogWindow::logwindow()->log( s ); |
213 | } | 224 | } |
214 | 225 | ||
215 | 226 | ||
216 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) | 227 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) |
217 | { | 228 | { |
218 | QString s; | 229 | QString s; |
219 | MScanListItem* network; | 230 | MScanListItem* network; |
220 | 231 | ||
221 | QListViewItemIterator it( this ); | 232 | QListViewItemIterator it( this ); |
222 | while ( it.current() && | 233 | while ( it.current() && |
223 | it.current()->text( col_ap ) != viaFrom && | 234 | it.current()->text( col_ap ) != viaFrom && |
224 | it.current()->text( col_ap ) != viaTo ) ++it; | 235 | it.current()->text( col_ap ) != viaTo ) ++it; |
225 | 236 | ||
226 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 237 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
227 | 238 | ||
228 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 239 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
229 | { | 240 | { |
230 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 241 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
231 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | 242 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); |
232 | } | 243 | } |
233 | else | 244 | else |
234 | { | 245 | { |
235 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); | 246 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
247 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); | ||
236 | } | 248 | } |
237 | } | 249 | } |
238 | 250 | ||
239 | 251 | ||
240 | void MScanListView::toDStraffic( QString from, QString to, QString via ) | 252 | void MScanListView::toDStraffic( QString from, QString to, QString via ) |
241 | { | 253 | { |
242 | QString s; | 254 | QString s; |
243 | MScanListItem* network; | 255 | MScanListItem* network; |
244 | 256 | ||
245 | QListViewItemIterator it( this ); | 257 | QListViewItemIterator it( this ); |
246 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 258 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
247 | 259 | ||
248 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 260 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
249 | 261 | ||
250 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 262 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
251 | { | 263 | { |
252 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); | 264 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
253 | } | 265 | } |
254 | else | 266 | else |
255 | { | 267 | { |
256 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 268 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
269 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); | ||
270 | |||
257 | } | 271 | } |
258 | } | 272 | } |
259 | 273 | ||
274 | |||
260 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) | 275 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) |
261 | { | 276 | { |
262 | QString s; | 277 | QString s; |
263 | MScanListItem* network; | 278 | MScanListItem* network; |
264 | 279 | ||
265 | QListViewItemIterator it( this ); | 280 | QListViewItemIterator it( this ); |
266 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 281 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
267 | 282 | ||
268 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 283 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
269 | 284 | ||
270 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 285 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
271 | { | 286 | { |
272 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | 287 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); |
273 | } | 288 | } |
274 | else | 289 | else |
275 | { | 290 | { |
276 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 291 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
292 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); | ||
277 | } | 293 | } |
278 | } | 294 | } |
279 | 295 | ||
296 | |||
280 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) | 297 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) |
281 | { | 298 | { |
282 | qWarning( "D'oh! Not yet implemented..." ); | 299 | qWarning( "D'oh! Not yet implemented..." ); |
300 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); | ||
283 | } | 301 | } |
284 | 302 | ||
303 | |||
304 | void MScanListView::identify( const QString& macaddr, const QString& ip ) | ||
305 | { | ||
306 | qDebug( "identify %s = %s", (const char*) macaddr, (const char*) ip ); | ||
307 | |||
308 | QListViewItemIterator it( this ); | ||
309 | for ( ; it.current(); ++it ) | ||
310 | { | ||
311 | if ( it.current()->text( col_ap ) == macaddr ) | ||
312 | { | ||
313 | it.current()->setText( col_ip, ip ); | ||
314 | return; | ||
315 | } | ||
316 | } | ||
317 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | ||
318 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", | ||
319 | (const char*) macaddr, (const char*) ip ) ); | ||
320 | } | ||
321 | |||
322 | |||
285 | //============================================================ | 323 | //============================================================ |
286 | // MScanListItem | 324 | // MScanListItem |
287 | //============================================================ | 325 | //============================================================ |
288 | 326 | ||
289 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 327 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
290 | bool wep, int channel, int signal ) | 328 | bool wep, int channel, int signal ) |
291 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 329 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
292 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 330 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
293 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 331 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
294 | { | 332 | { |
333 | #ifdef DEBUG | ||
295 | qDebug( "creating scanlist item" ); | 334 | qDebug( "creating scanlist item" ); |
335 | #endif | ||
296 | if ( WellenreiterConfigWindow::instance() && type == "network" ) | 336 | if ( WellenreiterConfigWindow::instance() && type == "network" ) |
297 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 337 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); |
298 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 338 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
299 | } | 339 | } |
300 | 340 | ||
301 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 341 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
302 | bool wep, int channel, int signal ) | 342 | bool wep, int channel, int signal ) |
303 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 343 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
304 | { | 344 | { |
345 | #ifdef DEBUG | ||
305 | qDebug( "creating scanlist item" ); | 346 | qDebug( "creating scanlist item" ); |
347 | #endif | ||
306 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 348 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
307 | } | 349 | } |
308 | 350 | ||
309 | OListViewItem* MScanListItem::childFactory() | 351 | OListViewItem* MScanListItem::childFactory() |
310 | { | 352 | { |
311 | return new MScanListItem( this ); | 353 | return new MScanListItem( this ); |
312 | } | 354 | } |
313 | 355 | ||
314 | void MScanListItem::serializeTo( QDataStream& s ) const | 356 | void MScanListItem::serializeTo( QDataStream& s ) const |
315 | { | 357 | { |
358 | #ifdef DEBUG | ||
316 | qDebug( "serializing MScanListItem" ); | 359 | qDebug( "serializing MScanListItem" ); |
360 | #endif | ||
317 | OListViewItem::serializeTo( s ); | 361 | OListViewItem::serializeTo( s ); |
318 | 362 | ||
319 | s << _type; | 363 | s << _type; |
320 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 364 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
321 | } | 365 | } |
322 | 366 | ||
323 | void MScanListItem::serializeFrom( QDataStream& s ) | 367 | void MScanListItem::serializeFrom( QDataStream& s ) |
324 | { | 368 | { |
369 | #ifdef DEBUG | ||
325 | qDebug( "serializing MScanListItem" ); | 370 | qDebug( "serializing MScanListItem" ); |
371 | #endif | ||
326 | OListViewItem::serializeFrom( s ); | 372 | OListViewItem::serializeFrom( s ); |
327 | 373 | ||
328 | char wep; | 374 | char wep; |
329 | s >> _type; | 375 | s >> _type; |
330 | s >> (Q_UINT8) wep; | 376 | s >> (Q_UINT8) wep; |
331 | _wep = (wep == 'y'); | 377 | _wep = (wep == 'y'); |
332 | 378 | ||
333 | QString name; | 379 | QString name; |
334 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 380 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
335 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 381 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
336 | if ( _wep ) | 382 | if ( _wep ) |
337 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 383 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
338 | listView()->triggerUpdate(); | 384 | listView()->triggerUpdate(); |
339 | } | 385 | } |
340 | 386 | ||
341 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 387 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
342 | { | 388 | { |
389 | #ifdef DEBUG | ||
343 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 390 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
344 | (const char*) type, | 391 | (const char*) type, |
345 | (const char*) essid, | 392 | (const char*) essid, |
346 | (const char*) macaddr, | 393 | (const char*) macaddr, |
347 | channel ); | 394 | channel ); |
395 | #endif | ||
348 | 396 | ||
349 | // set icon for managed or adhoc mode | 397 | // set icon for managed or adhoc mode |
350 | QString name; | 398 | QString name; |
351 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 399 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
352 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 400 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
353 | 401 | ||
354 | // set icon for wep (wireless encryption protocol) | 402 | // set icon for wep (wireless encryption protocol) |
355 | if ( wep ) | 403 | if ( wep ) |
356 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 404 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
357 | 405 | ||
358 | // set channel and signal text | 406 | // set channel and signal text |
359 | 407 | ||
360 | if ( signal != -1 ) | 408 | if ( signal != -1 ) |
361 | setText( col_sig, QString::number( signal ) ); | 409 | setText( col_sig, QString::number( signal ) ); |
362 | if ( channel != -1 ) | 410 | if ( channel != -1 ) |
363 | setText( col_channel, QString::number( channel ) ); | 411 | setText( col_channel, QString::number( channel ) ); |
364 | 412 | ||
365 | setText( col_firstseen, QTime::currentTime().toString() ); | 413 | setText( col_firstseen, QTime::currentTime().toString() ); |
366 | //setText( col_lastseen, QTime::currentTime().toString() ); | 414 | //setText( col_lastseen, QTime::currentTime().toString() ); |
367 | 415 | ||
368 | listView()->triggerUpdate(); | 416 | listView()->triggerUpdate(); |
369 | 417 | ||
370 | this->type = type; | 418 | this->type = type; |
371 | _type = type; | 419 | _type = type; |
372 | _essid = essid; | 420 | _essid = essid; |
373 | _macaddr = macaddr; | 421 | _macaddr = macaddr; |
374 | _channel = channel; | 422 | _channel = channel; |
375 | _beacons = 1; | 423 | _beacons = 1; |
376 | _signal = 0; | 424 | _signal = 0; |
377 | } | 425 | } |
378 | 426 | ||
379 | 427 | ||
380 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 428 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
381 | { | 429 | { |
382 | setText( col_manuf, manufacturer ); | 430 | setText( col_manuf, manufacturer ); |
383 | } | 431 | } |
384 | 432 | ||
385 | 433 | ||
386 | void MScanListItem::playSound( const QString& sound ) const | 434 | void MScanListItem::playSound( const QString& sound ) const |
387 | { | 435 | { |
388 | #ifdef QWS | 436 | #ifdef QWS |
389 | if ( sound == "Ignore" ) return; | 437 | if ( sound == "Ignore" ) return; |
390 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | 438 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); |
391 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | 439 | else if ( sound == "Key" ) ODevice::inst()->keySound(); |
392 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | 440 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); |
393 | #endif | 441 | #endif |
394 | } | 442 | } |
395 | 443 | ||
396 | 444 | ||
397 | void MScanListItem::receivedBeacon() | 445 | void MScanListItem::receivedBeacon() |
398 | { | 446 | { |
399 | _beacons++; | 447 | _beacons++; |
400 | #ifdef DEBUG | 448 | #ifdef DEBUG |
401 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 449 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
402 | #endif | 450 | #endif |
403 | setText( col_sig, QString::number( _beacons ) ); | 451 | setText( col_sig, QString::number( _beacons ) ); |
404 | setText( col_lastseen, QTime::currentTime().toString() ); | 452 | setText( col_lastseen, QTime::currentTime().toString() ); |
405 | if ( WellenreiterConfigWindow::instance() ) | 453 | if ( WellenreiterConfigWindow::instance() ) |
406 | playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); | 454 | playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); |
407 | } | 455 | } |
408 | 456 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 56bf837..4cb9216 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -1,133 +1,135 @@ | |||
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 SCANLIST_H | 16 | #ifndef SCANLIST_H |
17 | #define SCANLIST_H | 17 | #define SCANLIST_H |
18 | 18 | ||
19 | #include <opie2/olistview.h> | 19 | #include <opie2/olistview.h> |
20 | 20 | ||
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | 22 | ||
23 | class QString; | 23 | class QString; |
24 | class ManufacturerDB; | 24 | class ManufacturerDB; |
25 | 25 | ||
26 | class MScanListItem; | 26 | class MScanListItem; |
27 | 27 | ||
28 | class MScanListView: public OListView | 28 | class MScanListView: public OListView |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | MScanListView( QWidget* parent = 0, const char* name = 0 ); | 33 | MScanListView( QWidget* parent = 0, const char* name = 0 ); |
34 | virtual ~MScanListView(); | 34 | virtual ~MScanListView(); |
35 | 35 | ||
36 | void setManufacturerDB( ManufacturerDB* manufacturerdb ); | 36 | void setManufacturerDB( ManufacturerDB* manufacturerdb ); |
37 | 37 | ||
38 | virtual OListViewItem* childFactory(); | 38 | virtual OListViewItem* childFactory(); |
39 | virtual void serializeTo( QDataStream& s ) const; | 39 | virtual void serializeTo( QDataStream& s ) const; |
40 | virtual void serializeFrom( QDataStream& s ); | 40 | virtual void serializeFrom( QDataStream& s ); |
41 | 41 | ||
42 | public slots: | 42 | public slots: |
43 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 43 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); |
44 | void fromDStraffic( QString from, QString to, QString via ); // NYI | 44 | void fromDStraffic( QString from, QString to, QString via ); // NYI |
45 | void toDStraffic( QString from, QString to, QString via ); | 45 | void toDStraffic( QString from, QString to, QString via ); |
46 | void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ); | 46 | void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ); |
47 | void IBSStraffic( QString from, QString to, QString via ); // NYI | 47 | void IBSStraffic( QString from, QString to, QString via ); // NYI |
48 | 48 | ||
49 | void identify( const QString& macaddr, const QString& ipaddr ); | ||
50 | |||
49 | protected: | 51 | protected: |
50 | void addIfNotExisting( MScanListItem* parent, QString addr, const QString& type = "station" ); | 52 | void addIfNotExisting( MScanListItem* parent, QString addr, const QString& type = "station" ); |
51 | 53 | ||
52 | private: | 54 | private: |
53 | ManufacturerDB* _manufacturerdb; | 55 | ManufacturerDB* _manufacturerdb; |
54 | 56 | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | //****************************** MScanListItem **************************************************************** | 59 | //****************************** MScanListItem **************************************************************** |
58 | 60 | ||
59 | class MScanListItem: public OListViewItem | 61 | class MScanListItem: public OListViewItem |
60 | { | 62 | { |
61 | public: | 63 | public: |
62 | MScanListItem::MScanListItem( QListView* parent, | 64 | MScanListItem::MScanListItem( QListView* parent, |
63 | QString type = "unknown", | 65 | QString type = "unknown", |
64 | QString essid = "unknown", | 66 | QString essid = "unknown", |
65 | QString macaddr = "unknown", | 67 | QString macaddr = "unknown", |
66 | bool wep = false, | 68 | bool wep = false, |
67 | int channel = 0, | 69 | int channel = 0, |
68 | int signal = 0 ); | 70 | int signal = 0 ); |
69 | 71 | ||
70 | MScanListItem::MScanListItem( QListViewItem* parent, | 72 | MScanListItem::MScanListItem( QListViewItem* parent, |
71 | QString type = "unknown", | 73 | QString type = "unknown", |
72 | QString essid = "unknown", | 74 | QString essid = "unknown", |
73 | QString macaddr = "unknown", | 75 | QString macaddr = "unknown", |
74 | bool wep = false, | 76 | bool wep = false, |
75 | int channel = 0, | 77 | int channel = 0, |
76 | int signal = 0 ); | 78 | int signal = 0 ); |
77 | 79 | ||
78 | 80 | ||
79 | protected: | 81 | protected: |
80 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 82 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); |
81 | 83 | ||
82 | public: | 84 | public: |
83 | QString type; | 85 | QString type; |
84 | 86 | ||
85 | public: | 87 | public: |
86 | //const QString& type() { return _type; }; | 88 | //const QString& type() { return _type; }; |
87 | const QString& essid() { return _essid; }; | 89 | const QString& essid() { return _essid; }; |
88 | const QString& macaddr() { return _macaddr; }; | 90 | const QString& macaddr() { return _macaddr; }; |
89 | bool wep() { return _wep; }; | 91 | bool wep() { return _wep; }; |
90 | int channel() { return _channel; }; | 92 | int channel() { return _channel; }; |
91 | int signal() { return _signal; }; | 93 | int signal() { return _signal; }; |
92 | int beacons() { return _beacons; }; | 94 | int beacons() { return _beacons; }; |
93 | 95 | ||
94 | void setSignal( int signal ) { /* TODO */ }; | 96 | void setSignal( int signal ) { /* TODO */ }; |
95 | void receivedBeacon(); | 97 | void receivedBeacon(); |
96 | 98 | ||
97 | void setManufacturer( const QString& manufacturer ); | 99 | void setManufacturer( const QString& manufacturer ); |
98 | 100 | ||
99 | virtual OListViewItem* childFactory(); | 101 | virtual OListViewItem* childFactory(); |
100 | virtual void serializeTo( QDataStream& s ) const; | 102 | virtual void serializeTo( QDataStream& s ) const; |
101 | virtual void serializeFrom( QDataStream& s ); | 103 | virtual void serializeFrom( QDataStream& s ); |
102 | 104 | ||
103 | protected: | 105 | protected: |
104 | void playSound( const QString& ) const; | 106 | void playSound( const QString& ) const; |
105 | 107 | ||
106 | private: | 108 | private: |
107 | QString _type; | 109 | QString _type; |
108 | QString _essid; | 110 | QString _essid; |
109 | QString _macaddr; | 111 | QString _macaddr; |
110 | bool _wep; | 112 | bool _wep; |
111 | int _channel; | 113 | int _channel; |
112 | int _signal; | 114 | int _signal; |
113 | int _beacons; | 115 | int _beacons; |
114 | 116 | ||
115 | }; | 117 | }; |
116 | 118 | ||
117 | //****************************** MScanListViewFactory **************************************************************** | 119 | //****************************** MScanListViewFactory **************************************************************** |
118 | 120 | ||
119 | /* | 121 | /* |
120 | 122 | ||
121 | class MScanListViewFactory : public OListViewFactory | 123 | class MScanListViewFactory : public OListViewFactory |
122 | { | 124 | { |
123 | public: | 125 | public: |
124 | virtual QListView* listViewFactory(); | 126 | virtual QListView* listViewFactory(); |
125 | virtual QListViewItem* listViewItemFactory( QListView* lv ); | 127 | virtual QListViewItem* listViewItemFactory( QListView* lv ); |
126 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); | 128 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); |
127 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); | 129 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); |
128 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); | 130 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); |
129 | } | 131 | } |
130 | */ | 132 | */ |
131 | 133 | ||
132 | #endif | 134 | #endif |
133 | 135 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 62bda91..9e1010b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,397 +1,431 @@ | |||
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 | // Opie | 16 | // Opie |
17 | 17 | ||
18 | #ifdef QWS | 18 | #ifdef QWS |
19 | #include <opie/odevice.h> | 19 | #include <opie/odevice.h> |
20 | using namespace Opie; | 20 | using namespace Opie; |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef QWS | 23 | #ifdef QWS |
24 | #include <opie2/oapplication.h> | 24 | #include <opie2/oapplication.h> |
25 | #else | 25 | #else |
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #endif | 27 | #endif |
28 | #include <opie2/onetwork.h> | 28 | #include <opie2/onetwork.h> |
29 | #include <opie2/opcap.h> | 29 | #include <opie2/opcap.h> |
30 | 30 | ||
31 | // Qt | 31 | // Qt |
32 | 32 | ||
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
39 | #include <qregexp.h> | 39 | #include <qregexp.h> |
40 | #include <qspinbox.h> | 40 | #include <qspinbox.h> |
41 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | 43 | ||
44 | // Standard | 44 | // Standard |
45 | 45 | ||
46 | #include <assert.h> | 46 | #include <assert.h> |
47 | #include <errno.h> | 47 | #include <errno.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | #include <string.h> | 49 | #include <string.h> |
50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | 52 | ||
53 | // Local | 53 | // Local |
54 | 54 | ||
55 | #include "wellenreiter.h" | 55 | #include "wellenreiter.h" |
56 | #include "scanlist.h" | 56 | #include "scanlist.h" |
57 | #include "logwindow.h" | 57 | #include "logwindow.h" |
58 | #include "hexwindow.h" | 58 | #include "hexwindow.h" |
59 | #include "configwindow.h" | 59 | #include "configwindow.h" |
60 | #include "statwindow.h" | 60 | #include "statwindow.h" |
61 | #include "graphwindow.h" | 61 | #include "graphwindow.h" |
62 | #include "manufacturers.h" | 62 | #include "manufacturers.h" |
63 | 63 | ||
64 | Wellenreiter::Wellenreiter( QWidget* parent ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent ) |
65 | : WellenreiterBase( parent, 0, 0 ), | 65 | : WellenreiterBase( parent, 0, 0 ), |
66 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) | 66 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) |
67 | { | 67 | { |
68 | 68 | ||
69 | // | 69 | // |
70 | // construct manufacturer database | 70 | // construct manufacturer database |
71 | // | 71 | // |
72 | 72 | ||
73 | QString manufile; | 73 | QString manufile; |
74 | #ifdef QWS | 74 | #ifdef QWS |
75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | 75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); |
76 | #else | 76 | #else |
77 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); | 77 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); |
78 | #endif | 78 | #endif |
79 | manufacturerdb = new ManufacturerDB( manufile ); | 79 | manufacturerdb = new ManufacturerDB( manufile ); |
80 | 80 | ||
81 | logwindow->log( "(i) Wellenreiter has been started." ); | 81 | logwindow->log( "(i) Wellenreiter has been started." ); |
82 | 82 | ||
83 | // | 83 | // |
84 | // detect operating system | 84 | // detect operating system |
85 | // | 85 | // |
86 | 86 | ||
87 | #ifdef QWS | 87 | #ifdef QWS |
88 | QString sys; | 88 | QString sys; |
89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
90 | _system = ODevice::inst()->system(); | 90 | _system = ODevice::inst()->system(); |
91 | logwindow->log( sys ); | 91 | logwindow->log( sys ); |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | // setup GUI | 94 | // setup GUI |
95 | netview->setColumnWidthMode( 1, QListView::Manual ); | 95 | netview->setColumnWidthMode( 1, QListView::Manual ); |
96 | 96 | ||
97 | if ( manufacturerdb ) | 97 | if ( manufacturerdb ) |
98 | netview->setManufacturerDB( manufacturerdb ); | 98 | netview->setManufacturerDB( manufacturerdb ); |
99 | 99 | ||
100 | pcap = new OPacketCapturer(); | 100 | pcap = new OPacketCapturer(); |
101 | 101 | ||
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | Wellenreiter::~Wellenreiter() | 105 | Wellenreiter::~Wellenreiter() |
106 | { | 106 | { |
107 | // no need to delete child widgets, Qt does it all for us | 107 | // no need to delete child widgets, Qt does it all for us |
108 | 108 | ||
109 | delete manufacturerdb; | 109 | delete manufacturerdb; |
110 | delete pcap; | 110 | delete pcap; |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 114 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
115 | { | 115 | { |
116 | configwindow = cw; | 116 | configwindow = cw; |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | void Wellenreiter::channelHopped(int c) | 120 | void Wellenreiter::channelHopped(int c) |
121 | { | 121 | { |
122 | QString title = "Wellenreiter II -scan- ["; | 122 | QString title = "Wellenreiter II -scan- ["; |
123 | QString left; | 123 | QString left; |
124 | if ( c > 1 ) left.fill( '.', c-1 ); | 124 | if ( c > 1 ) left.fill( '.', c-1 ); |
125 | title.append( left ); | 125 | title.append( left ); |
126 | title.append( '|' ); | 126 | title.append( '|' ); |
127 | if ( c < iface->channels() ) | 127 | if ( c < iface->channels() ) |
128 | { | 128 | { |
129 | QString right; | 129 | QString right; |
130 | right.fill( '.', iface->channels()-c ); | 130 | right.fill( '.', iface->channels()-c ); |
131 | title.append( right ); | 131 | title.append( right ); |
132 | } | 132 | } |
133 | title.append( "]" ); | 133 | title.append( "]" ); |
134 | //title.append( QString().sprintf( " %02d", c ) ); | 134 | //title.append( QString().sprintf( " %02d", c ) ); |
135 | assert( parent() ); | 135 | assert( parent() ); |
136 | ( (QMainWindow*) parent() )->setCaption( title ); | 136 | ( (QMainWindow*) parent() )->setCaption( title ); |
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | void Wellenreiter::receivePacket(OPacket* p) | 140 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
141 | { | 141 | { |
142 | hexWindow()->log( p->dump( 8 ) ); | 142 | QString type; |
143 | if ( beacon->canIBSS() ) | ||
144 | { | ||
145 | type = "adhoc"; | ||
146 | } | ||
147 | else if ( beacon->canESS() ) | ||
148 | { | ||
149 | type = "managed"; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | ||
154 | return; | ||
155 | } | ||
143 | 156 | ||
144 | // check if we received a beacon frame | 157 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
145 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 158 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
146 | if ( beacon && beacon->managementType() == "Beacon" ) | 159 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
160 | int channel = ds ? ds->channel() : -1; | ||
161 | |||
162 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | ||
163 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); | ||
164 | |||
165 | // update graph window | ||
166 | if ( ds ) | ||
147 | { | 167 | { |
148 | QString type; | 168 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
149 | if ( beacon->canIBSS() ) | 169 | if ( prism ) |
150 | { | 170 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
151 | type = "adhoc"; | 171 | else |
152 | } | 172 | graphwindow->traffic( ds->channel(), 95 ); |
153 | else if ( beacon->canESS() ) | 173 | } |
174 | } | ||
175 | |||
176 | |||
177 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | ||
178 | { | ||
179 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | ||
180 | if ( wlan->fromDS() && !wlan->toDS() ) | ||
181 | { | ||
182 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | ||
183 | (const char*) wlan->macAddress3().toString(true), | ||
184 | (const char*) wlan->macAddress1().toString(true), | ||
185 | (const char*) wlan->macAddress2().toString(true) ); | ||
186 | netView()->fromDStraffic( wlan->macAddress3().toString(), | ||
187 | wlan->macAddress1().toString(), | ||
188 | wlan->macAddress2().toString() ); | ||
189 | } | ||
190 | else | ||
191 | if ( !wlan->fromDS() && wlan->toDS() ) | ||
192 | { | ||
193 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", | ||
194 | (const char*) wlan->macAddress2().toString(true), | ||
195 | (const char*) wlan->macAddress3().toString(true), | ||
196 | (const char*) wlan->macAddress1().toString(true) ); | ||
197 | netView()->toDStraffic( wlan->macAddress2().toString(), | ||
198 | wlan->macAddress3().toString(), | ||
199 | wlan->macAddress1().toString() ); | ||
200 | } | ||
201 | else | ||
202 | if ( wlan->fromDS() && wlan->toDS() ) | ||
203 | { | ||
204 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | ||
205 | (const char*) wlan->macAddress4().toString(true), | ||
206 | (const char*) wlan->macAddress3().toString(true), | ||
207 | (const char*) wlan->macAddress1().toString(true), | ||
208 | (const char*) wlan->macAddress2().toString(true) ); | ||
209 | netView()->WDStraffic( wlan->macAddress4().toString(), | ||
210 | wlan->macAddress3().toString(), | ||
211 | wlan->macAddress1().toString(), | ||
212 | wlan->macAddress2().toString() ); | ||
213 | } | ||
214 | else | ||
215 | { | ||
216 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", | ||
217 | (const char*) wlan->macAddress2().toString(true), | ||
218 | (const char*) wlan->macAddress1().toString(true), | ||
219 | (const char*) wlan->macAddress3().toString(true) ); | ||
220 | netView()->IBSStraffic( wlan->macAddress2().toString(), | ||
221 | wlan->macAddress1().toString(), | ||
222 | wlan->macAddress3().toString() ); | ||
223 | } | ||
224 | |||
225 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | ||
226 | if ( arp ) | ||
227 | { | ||
228 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | ||
229 | if ( arp->type() == "REQUEST" ) | ||
154 | { | 230 | { |
155 | type = "managed"; | 231 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); |
156 | } | 232 | } |
157 | else | 233 | else if ( arp->type() == "REPLY" ) |
158 | { | 234 | { |
159 | qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); | 235 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); |
160 | return; | 236 | netView()->identify( arp->targetMacAddress().toString(), arp->targetIPV4Address().toString() ); |
161 | } | 237 | } |
238 | } | ||
239 | |||
240 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); | ||
241 | if ( ip ) | ||
242 | { | ||
243 | qDebug( "Received IP packet." ); | ||
244 | } | ||
245 | } | ||
162 | 246 | ||
163 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | ||
164 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | ||
165 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | ||
166 | int channel = ds ? ds->channel() : -1; | ||
167 | 247 | ||
168 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 248 | void Wellenreiter::receivePacket( OPacket* p ) |
169 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); | 249 | { |
250 | hexWindow()->log( p->dump( 8 ) ); | ||
170 | 251 | ||
171 | // update graph window | 252 | // check if we received a beacon frame |
172 | if ( ds ) | 253 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
173 | { | 254 | if ( beacon && beacon->managementType() == "Beacon" ) |
174 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 255 | { |
175 | if ( prism ) | 256 | handleBeacon( p, beacon ); |
176 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | ||
177 | else | ||
178 | graphwindow->traffic( ds->channel(), 95 ); | ||
179 | } | ||
180 | return; | 257 | return; |
181 | } | 258 | } |
182 | 259 | ||
260 | //TODO: WEP check here | ||
261 | |||
183 | // check for a data frame | 262 | // check for a data frame |
184 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); | 263 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); |
185 | if ( data ) | 264 | if ( data ) |
186 | { | 265 | { |
187 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 266 | handleData( p, data ); |
188 | if ( wlan->fromDS() && !wlan->toDS() ) | ||
189 | { | ||
190 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | ||
191 | (const char*) wlan->macAddress3().toString(true), | ||
192 | (const char*) wlan->macAddress1().toString(true), | ||
193 | (const char*) wlan->macAddress2().toString(true) ); | ||
194 | netView()->fromDStraffic( wlan->macAddress3().toString(), | ||
195 | wlan->macAddress1().toString(), | ||
196 | wlan->macAddress2().toString() ); | ||
197 | } | ||
198 | else | ||
199 | if ( !wlan->fromDS() && wlan->toDS() ) | ||
200 | { | ||
201 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", | ||
202 | (const char*) wlan->macAddress2().toString(true), | ||
203 | (const char*) wlan->macAddress3().toString(true), | ||
204 | (const char*) wlan->macAddress1().toString(true) ); | ||
205 | netView()->toDStraffic( wlan->macAddress2().toString(), | ||
206 | wlan->macAddress3().toString(), | ||
207 | wlan->macAddress1().toString() ); | ||
208 | } | ||
209 | else | ||
210 | if ( wlan->fromDS() && wlan->toDS() ) | ||
211 | { | ||
212 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | ||
213 | (const char*) wlan->macAddress4().toString(true), | ||
214 | (const char*) wlan->macAddress3().toString(true), | ||
215 | (const char*) wlan->macAddress1().toString(true), | ||
216 | (const char*) wlan->macAddress2().toString(true) ); | ||
217 | netView()->WDStraffic( wlan->macAddress4().toString(), | ||
218 | wlan->macAddress3().toString(), | ||
219 | wlan->macAddress1().toString(), | ||
220 | wlan->macAddress2().toString() ); | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", | ||
225 | (const char*) wlan->macAddress2().toString(true), | ||
226 | (const char*) wlan->macAddress1().toString(true), | ||
227 | (const char*) wlan->macAddress3().toString(true) ); | ||
228 | netView()->IBSStraffic( wlan->macAddress2().toString(), | ||
229 | wlan->macAddress1().toString(), | ||
230 | wlan->macAddress3().toString() ); | ||
231 | } | ||
232 | return; | ||
233 | } | 267 | } |
234 | } | 268 | } |
235 | 269 | ||
236 | 270 | ||
237 | void Wellenreiter::stopClicked() | 271 | void Wellenreiter::stopClicked() |
238 | { | 272 | { |
239 | if ( iface ) | 273 | if ( iface ) |
240 | { | 274 | { |
241 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 275 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
242 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 276 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
243 | iface->setChannelHopping(); // stop hopping channels | 277 | iface->setChannelHopping(); // stop hopping channels |
244 | } | 278 | } |
245 | else | 279 | else |
246 | killTimers(); | 280 | killTimers(); |
247 | 281 | ||
248 | pcap->close(); | 282 | pcap->close(); |
249 | sniffing = false; | 283 | sniffing = false; |
250 | 284 | ||
251 | if ( iface ) | 285 | if ( iface ) |
252 | { | 286 | { |
253 | // switch off monitor mode | 287 | // switch off monitor mode |
254 | iface->setMonitorMode( false ); | 288 | iface->setMonitorMode( false ); |
255 | // switch off promisc flag | 289 | // switch off promisc flag |
256 | iface->setPromiscuousMode( false ); | 290 | iface->setPromiscuousMode( false ); |
257 | 291 | ||
258 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 292 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
259 | } | 293 | } |
260 | 294 | ||
261 | logwindow->log( "(i) Stopped Scanning." ); | 295 | logwindow->log( "(i) Stopped Scanning." ); |
262 | assert( parent() ); | 296 | assert( parent() ); |
263 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 297 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
264 | 298 | ||
265 | // message the user | 299 | // message the user |
266 | QMessageBox::information( this, "Wellenreiter II", | 300 | QMessageBox::information( this, "Wellenreiter II", |
267 | tr( "Your wireless card\nshould now be usable again." ) ); | 301 | tr( "Your wireless card\nshould now be usable again." ) ); |
268 | 302 | ||
269 | sniffing = false; | 303 | sniffing = false; |
270 | emit( stoppedSniffing() ); | 304 | emit( stoppedSniffing() ); |
271 | 305 | ||
272 | // print out statistics | 306 | // print out statistics |
273 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 307 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
274 | statwindow->updateCounter( it.key(), it.data() ); | 308 | statwindow->updateCounter( it.key(), it.data() ); |
275 | } | 309 | } |
276 | 310 | ||
277 | 311 | ||
278 | void Wellenreiter::startClicked() | 312 | void Wellenreiter::startClicked() |
279 | { | 313 | { |
280 | // get configuration from config window | 314 | // get configuration from config window |
281 | 315 | ||
282 | const QString& interface = configwindow->interfaceName->currentText(); | 316 | const QString& interface = configwindow->interfaceName->currentText(); |
283 | const int cardtype = configwindow->daemonDeviceType(); | 317 | const int cardtype = configwindow->daemonDeviceType(); |
284 | const int interval = configwindow->daemonHopInterval(); | 318 | const int interval = configwindow->daemonHopInterval(); |
285 | 319 | ||
286 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 320 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
287 | { | 321 | { |
288 | QMessageBox::information( this, "Wellenreiter II", | 322 | QMessageBox::information( this, "Wellenreiter II", |
289 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 323 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
290 | return; | 324 | return; |
291 | } | 325 | } |
292 | 326 | ||
293 | // configure device | 327 | // configure device |
294 | 328 | ||
295 | ONetwork* net = ONetwork::instance(); | 329 | ONetwork* net = ONetwork::instance(); |
296 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 330 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
297 | 331 | ||
298 | // set monitor mode | 332 | // set monitor mode |
299 | 333 | ||
300 | switch ( cardtype ) | 334 | switch ( cardtype ) |
301 | { | 335 | { |
302 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; | 336 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; |
303 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | 337 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
304 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | 338 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
305 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | 339 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; |
306 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 340 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
307 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 341 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
308 | default: assert( 0 ); // shouldn't reach this | 342 | default: assert( 0 ); // shouldn't reach this |
309 | } | 343 | } |
310 | 344 | ||
311 | // switch device into monitor mode | 345 | // switch device into monitor mode |
312 | if ( cardtype < DEVTYPE_FILE ) | 346 | if ( cardtype < DEVTYPE_FILE ) |
313 | { | 347 | { |
314 | if ( cardtype != DEVTYPE_MANUAL ) | 348 | if ( cardtype != DEVTYPE_MANUAL ) |
315 | iface->setMonitorMode( true ); | 349 | iface->setMonitorMode( true ); |
316 | if ( !iface->monitorMode() ) | 350 | if ( !iface->monitorMode() ) |
317 | { | 351 | { |
318 | QMessageBox::warning( this, "Wellenreiter II", | 352 | QMessageBox::warning( this, "Wellenreiter II", |
319 | tr( "Can't set device into monitor mode." ) ); | 353 | tr( "Can't set device into monitor mode." ) ); |
320 | return; | 354 | return; |
321 | } | 355 | } |
322 | } | 356 | } |
323 | 357 | ||
324 | // open pcap and start sniffing | 358 | // open pcap and start sniffing |
325 | if ( cardtype != DEVTYPE_FILE ) | 359 | if ( cardtype != DEVTYPE_FILE ) |
326 | { | 360 | { |
327 | if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? | 361 | if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? |
328 | { | 362 | { |
329 | QString dumpname( configwindow->captureFileName->text() ); | 363 | QString dumpname( configwindow->captureFileName->text() ); |
330 | dumpname.append( '-' ); | 364 | dumpname.append( '-' ); |
331 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 365 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
332 | dumpname.append( ".wellenreiter" ); | 366 | dumpname.append( ".wellenreiter" ); |
333 | pcap->open( interface, dumpname ); | 367 | pcap->open( interface, dumpname ); |
334 | } | 368 | } |
335 | else | 369 | else |
336 | { | 370 | { |
337 | pcap->open( interface ); | 371 | pcap->open( interface ); |
338 | } | 372 | } |
339 | } | 373 | } |
340 | else | 374 | else |
341 | { | 375 | { |
342 | pcap->open( QFile( interface ) ); | 376 | pcap->open( QFile( interface ) ); |
343 | } | 377 | } |
344 | 378 | ||
345 | if ( !pcap->isOpen() ) | 379 | if ( !pcap->isOpen() ) |
346 | { | 380 | { |
347 | QMessageBox::warning( this, "Wellenreiter II", | 381 | QMessageBox::warning( this, "Wellenreiter II", |
348 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); | 382 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); |
349 | return; | 383 | return; |
350 | } | 384 | } |
351 | 385 | ||
352 | // set capturer to non-blocking mode | 386 | // set capturer to non-blocking mode |
353 | pcap->setBlocking( false ); | 387 | pcap->setBlocking( false ); |
354 | 388 | ||
355 | // start channel hopper | 389 | // start channel hopper |
356 | if ( cardtype != DEVTYPE_FILE ) | 390 | if ( cardtype != DEVTYPE_FILE ) |
357 | iface->setChannelHopping( 1000 ); //use interval from config window | 391 | iface->setChannelHopping( 1000 ); //use interval from config window |
358 | 392 | ||
359 | if ( cardtype != DEVTYPE_FILE ) | 393 | if ( cardtype != DEVTYPE_FILE ) |
360 | { | 394 | { |
361 | // connect socket notifier and start channel hopper | 395 | // connect socket notifier and start channel hopper |
362 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 396 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
363 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 397 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
364 | } | 398 | } |
365 | else | 399 | else |
366 | { | 400 | { |
367 | // start timer for reading packets | 401 | // start timer for reading packets |
368 | startTimer( 100 ); | 402 | startTimer( 100 ); |
369 | } | 403 | } |
370 | 404 | ||
371 | logwindow->log( "(i) Started Scanning." ); | 405 | logwindow->log( "(i) Started Scanning." ); |
372 | sniffing = true; | 406 | sniffing = true; |
373 | emit( startedSniffing() ); | 407 | emit( startedSniffing() ); |
374 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 408 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
375 | else | 409 | else |
376 | { | 410 | { |
377 | assert( parent() ); | 411 | assert( parent() ); |
378 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 412 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
379 | } | 413 | } |
380 | } | 414 | } |
381 | 415 | ||
382 | 416 | ||
383 | void Wellenreiter::timerEvent( QTimerEvent* ) | 417 | void Wellenreiter::timerEvent( QTimerEvent* ) |
384 | { | 418 | { |
385 | qDebug( "Wellenreiter::timerEvent()" ); | 419 | qDebug( "Wellenreiter::timerEvent()" ); |
386 | OPacket* p = pcap->next(); | 420 | OPacket* p = pcap->next(); |
387 | if ( !p ) // no more packets available | 421 | if ( !p ) // no more packets available |
388 | { | 422 | { |
389 | stopClicked(); | 423 | stopClicked(); |
390 | } | 424 | } |
391 | else | 425 | else |
392 | { | 426 | { |
393 | receivePacket( p ); | 427 | receivePacket( p ); |
394 | delete p; | 428 | delete p; |
395 | } | 429 | } |
396 | } | 430 | } |
397 | 431 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index c37a9f2..ea8a692 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -1,81 +1,86 @@ | |||
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; | ||
30 | class OWaveLanDataPacket; | ||
29 | class OPacketCapturer; | 31 | class OPacketCapturer; |
30 | class OWirelessNetworkInterface; | 32 | class OWirelessNetworkInterface; |
31 | |||
32 | class ManufacturerDB; | 33 | class ManufacturerDB; |
33 | class WellenreiterConfigWindow; | 34 | class WellenreiterConfigWindow; |
34 | class MLogWindow; | 35 | class MLogWindow; |
35 | class MHexWindow; | 36 | class MHexWindow; |
36 | 37 | ||
37 | class Wellenreiter : public WellenreiterBase { | 38 | class Wellenreiter : public WellenreiterBase { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | 40 | ||
40 | public: | 41 | public: |
41 | Wellenreiter( QWidget* parent = 0 ); | 42 | Wellenreiter( QWidget* parent = 0 ); |
42 | ~Wellenreiter(); | 43 | ~Wellenreiter(); |
43 | 44 | ||
44 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 45 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
45 | MScanListView* netView() const { return netview; }; | 46 | MScanListView* netView() const { return netview; }; |
46 | MLogWindow* logWindow() const { return logwindow; }; | 47 | MLogWindow* logWindow() const { return logwindow; }; |
47 | MHexWindow* hexWindow() const { return hexwindow; }; | 48 | MHexWindow* hexWindow() const { return hexwindow; }; |
48 | bool isDaemonRunning() const { return sniffing; }; | 49 | bool isDaemonRunning() const { return sniffing; }; |
49 | 50 | ||
50 | bool sniffing; | 51 | bool sniffing; |
51 | 52 | ||
52 | protected: | 53 | protected: |
53 | virtual void timerEvent( QTimerEvent* ); | 54 | virtual void timerEvent( QTimerEvent* ); |
54 | 55 | ||
55 | public slots: | 56 | public slots: |
56 | void channelHopped(int); | 57 | void channelHopped(int); |
57 | void receivePacket(OPacket*); | 58 | void receivePacket(OPacket*); |
58 | void startClicked(); | 59 | void startClicked(); |
59 | void stopClicked(); | 60 | void stopClicked(); |
60 | 61 | ||
61 | signals: | 62 | signals: |
62 | void startedSniffing(); | 63 | void startedSniffing(); |
63 | void stoppedSniffing(); | 64 | void stoppedSniffing(); |
64 | 65 | ||
65 | private: | 66 | private: |
67 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); | ||
68 | void handleData( OPacket* p, OWaveLanDataPacket* data ); | ||
69 | |||
70 | private: | ||
66 | #ifdef QWS | 71 | #ifdef QWS |
67 | OSystem _system; // Opie Operating System identifier | 72 | OSystem _system; // Opie Operating System identifier |
68 | #endif | 73 | #endif |
69 | 74 | ||
70 | OWirelessNetworkInterface* iface; | 75 | OWirelessNetworkInterface* iface; |
71 | OPacketCapturer* pcap; | 76 | OPacketCapturer* pcap; |
72 | ManufacturerDB* manufacturerdb; | 77 | ManufacturerDB* manufacturerdb; |
73 | WellenreiterConfigWindow* configwindow; | 78 | WellenreiterConfigWindow* configwindow; |
74 | 79 | ||
75 | //void readConfig(); | 80 | //void readConfig(); |
76 | //void writeConfig(); | 81 | //void writeConfig(); |
77 | }; | 82 | }; |
78 | 83 | ||
79 | 84 | ||
80 | 85 | ||
81 | #endif | 86 | #endif |