author | mickeyl <mickeyl> | 2003-12-09 19:24:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-09 19:24:37 (UTC) |
commit | 04d6caa37743a1957b9ffa061a58a71a3909ea3d (patch) (unidiff) | |
tree | 04a692f57263d0573f2b2c704e4a6e1057aa7d40 | |
parent | 1642df2b072858b5eec9ad007a23475cc5270bfe (diff) | |
download | opie-04d6caa37743a1957b9ffa061a58a71a3909ea3d.zip opie-04d6caa37743a1957b9ffa061a58a71a3909ea3d.tar.gz opie-04d6caa37743a1957b9ffa061a58a71a3909ea3d.tar.bz2 |
preload the manufacturer library during startup (nice trick, btw.)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 365efb0..1d4a98b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -9,123 +9,135 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Local | 16 | // Local |
17 | 17 | ||
18 | #include "gps.h" | 18 | #include "gps.h" |
19 | #include "wellenreiter.h" | 19 | #include "wellenreiter.h" |
20 | #include "scanlist.h" | 20 | #include "scanlist.h" |
21 | #include "logwindow.h" | 21 | #include "logwindow.h" |
22 | #include "hexwindow.h" | 22 | #include "hexwindow.h" |
23 | #include "configwindow.h" | 23 | #include "configwindow.h" |
24 | #include "statwindow.h" | 24 | #include "statwindow.h" |
25 | #include "graphwindow.h" | 25 | #include "graphwindow.h" |
26 | #include "protolistview.h" | 26 | #include "protolistview.h" |
27 | 27 | ||
28 | // Opie | 28 | // Opie |
29 | 29 | ||
30 | #ifdef QWS | 30 | #ifdef QWS |
31 | #include <opie/odevice.h> | 31 | #include <opie/odevice.h> |
32 | #include <qpe/qcopenvelope_qws.h> | 32 | #include <qpe/qcopenvelope_qws.h> |
33 | using namespace Opie; | 33 | using namespace Opie; |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #ifdef QWS | 36 | #ifdef QWS |
37 | #include <opie2/oapplication.h> | 37 | #include <opie2/oapplication.h> |
38 | #else | 38 | #else |
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #endif | 40 | #endif |
41 | #include <opie2/omanufacturerdb.h> | ||
41 | #include <opie2/onetwork.h> | 42 | #include <opie2/onetwork.h> |
42 | #include <opie2/opcap.h> | 43 | #include <opie2/opcap.h> |
43 | 44 | ||
44 | // Qt | 45 | // Qt |
45 | 46 | ||
46 | #include <qcheckbox.h> | 47 | #include <qcheckbox.h> |
47 | #include <qcombobox.h> | 48 | #include <qcombobox.h> |
48 | #include <qdatetime.h> | 49 | #include <qdatetime.h> |
49 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
50 | #include <qlineedit.h> | 51 | #include <qlineedit.h> |
51 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
52 | #include <qobjectlist.h> | 53 | #include <qobjectlist.h> |
53 | #include <qregexp.h> | 54 | #include <qregexp.h> |
54 | #include <qspinbox.h> | 55 | #include <qspinbox.h> |
56 | #include <qtimer.h> | ||
55 | #include <qtoolbutton.h> | 57 | #include <qtoolbutton.h> |
56 | #include <qmainwindow.h> | 58 | #include <qmainwindow.h> |
57 | 59 | ||
58 | // Standard | 60 | // Standard |
59 | 61 | ||
60 | #include <assert.h> | 62 | #include <assert.h> |
61 | #include <errno.h> | 63 | #include <errno.h> |
62 | #include <unistd.h> | 64 | #include <unistd.h> |
63 | #include <string.h> | 65 | #include <string.h> |
64 | #include <sys/types.h> | 66 | #include <sys/types.h> |
65 | #include <stdlib.h> | 67 | #include <stdlib.h> |
66 | 68 | ||
67 | Wellenreiter::Wellenreiter( QWidget* parent ) | 69 | Wellenreiter::Wellenreiter( QWidget* parent ) |
68 | : WellenreiterBase( parent, 0, 0 ), | 70 | : WellenreiterBase( parent, 0, 0 ), |
69 | sniffing( false ), iface( 0 ), configwindow( 0 ) | 71 | sniffing( false ), iface( 0 ), configwindow( 0 ) |
70 | { | 72 | { |
71 | 73 | ||
72 | logwindow->log( "(i) Wellenreiter has been started." ); | 74 | logwindow->log( "(i) Wellenreiter has been started." ); |
73 | 75 | ||
74 | // | 76 | // |
75 | // detect operating system | 77 | // detect operating system |
76 | // | 78 | // |
77 | 79 | ||
78 | #ifdef QWS | 80 | #ifdef QWS |
79 | QString sys; | 81 | QString sys; |
80 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 82 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
81 | _system = ODevice::inst()->system(); | 83 | _system = ODevice::inst()->system(); |
82 | logwindow->log( sys ); | 84 | logwindow->log( sys ); |
83 | #endif | 85 | #endif |
84 | 86 | ||
85 | netview->setColumnWidthMode( 1, QListView::Manual ); | 87 | netview->setColumnWidthMode( 1, QListView::Manual ); |
86 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), | 88 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), |
87 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); | 89 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); |
88 | pcap = new OPacketCapturer(); | 90 | pcap = new OPacketCapturer(); |
89 | 91 | ||
90 | gps = new GPS( this ); | 92 | gps = new GPS( this ); |
93 | |||
94 | QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); | ||
95 | |||
91 | } | 96 | } |
92 | 97 | ||
93 | 98 | ||
94 | Wellenreiter::~Wellenreiter() | 99 | Wellenreiter::~Wellenreiter() |
95 | { | 100 | { |
96 | delete pcap; | 101 | delete pcap; |
97 | } | 102 | } |
98 | 103 | ||
99 | 104 | ||
105 | void Wellenreiter::initialTimer() | ||
106 | { | ||
107 | qDebug( "Wellenreiter::preloading manufacturer database..." ); | ||
108 | OManufacturerDB::instance(); | ||
109 | } | ||
110 | |||
111 | |||
100 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 112 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
101 | { | 113 | { |
102 | configwindow = cw; | 114 | configwindow = cw; |
103 | } | 115 | } |
104 | 116 | ||
105 | 117 | ||
106 | void Wellenreiter::channelHopped(int c) | 118 | void Wellenreiter::channelHopped(int c) |
107 | { | 119 | { |
108 | QString title = "Wellenreiter II -scan- ["; | 120 | QString title = "Wellenreiter II -scan- ["; |
109 | QString left; | 121 | QString left; |
110 | if ( c > 1 ) left.fill( '.', c-1 ); | 122 | if ( c > 1 ) left.fill( '.', c-1 ); |
111 | title.append( left ); | 123 | title.append( left ); |
112 | title.append( '|' ); | 124 | title.append( '|' ); |
113 | if ( c < iface->channels() ) | 125 | if ( c < iface->channels() ) |
114 | { | 126 | { |
115 | QString right; | 127 | QString right; |
116 | right.fill( '.', iface->channels()-c ); | 128 | right.fill( '.', iface->channels()-c ); |
117 | title.append( right ); | 129 | title.append( right ); |
118 | } | 130 | } |
119 | title.append( "]" ); | 131 | title.append( "]" ); |
120 | //title.append( QString().sprintf( " %02d", c ) ); | 132 | //title.append( QString().sprintf( " %02d", c ) ); |
121 | assert( parent() ); | 133 | assert( parent() ); |
122 | ( (QMainWindow*) parent() )->setCaption( title ); | 134 | ( (QMainWindow*) parent() )->setCaption( title ); |
123 | } | 135 | } |
124 | 136 | ||
125 | 137 | ||
126 | void Wellenreiter::handleNotification( OPacket* p ) | 138 | void Wellenreiter::handleNotification( OPacket* p ) |
127 | { | 139 | { |
128 | QObjectList* l = p->queryList(); | 140 | QObjectList* l = p->queryList(); |
129 | QObjectListIt it( *l ); | 141 | QObjectListIt it( *l ); |
130 | QObject* o; | 142 | QObject* o; |
131 | 143 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 25a5e8d..d882500 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -30,64 +30,66 @@ class OWaveLanManagementPacket; | |||
30 | class OWaveLanDataPacket; | 30 | class OWaveLanDataPacket; |
31 | class OEthernetPacket; | 31 | class OEthernetPacket; |
32 | class OARPPacket; | 32 | class OARPPacket; |
33 | class OMacAddress; | 33 | class OMacAddress; |
34 | class OIPPacket; | 34 | class OIPPacket; |
35 | class OPacketCapturer; | 35 | class OPacketCapturer; |
36 | class OWirelessNetworkInterface; | 36 | class OWirelessNetworkInterface; |
37 | class WellenreiterConfigWindow; | 37 | class WellenreiterConfigWindow; |
38 | class MLogWindow; | 38 | class MLogWindow; |
39 | class MHexWindow; | 39 | class MHexWindow; |
40 | class GPS; | 40 | class GPS; |
41 | 41 | ||
42 | class Wellenreiter : public WellenreiterBase { | 42 | class Wellenreiter : public WellenreiterBase { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | 44 | ||
45 | public: | 45 | public: |
46 | Wellenreiter( QWidget* parent = 0 ); | 46 | Wellenreiter( QWidget* parent = 0 ); |
47 | ~Wellenreiter(); | 47 | ~Wellenreiter(); |
48 | 48 | ||
49 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 49 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
50 | MScanListView* netView() const { return netview; }; | 50 | MScanListView* netView() const { return netview; }; |
51 | MLogWindow* logWindow() const { return logwindow; }; | 51 | MLogWindow* logWindow() const { return logwindow; }; |
52 | MHexWindow* hexWindow() const { return hexwindow; }; | 52 | MHexWindow* hexWindow() const { return hexwindow; }; |
53 | bool isDaemonRunning() const { return sniffing; }; | 53 | bool isDaemonRunning() const { return sniffing; }; |
54 | 54 | ||
55 | public: | 55 | public: |
56 | bool sniffing; | 56 | bool sniffing; |
57 | 57 | ||
58 | protected: | 58 | protected: |
59 | virtual void timerEvent( QTimerEvent* ); | 59 | virtual void timerEvent( QTimerEvent* ); |
60 | 60 | ||
61 | public slots: | 61 | public slots: |
62 | void initialTimer(); | ||
63 | |||
62 | void channelHopped(int); | 64 | void channelHopped(int); |
63 | void receivePacket(OPacket*); | 65 | void receivePacket(OPacket*); |
64 | void startClicked(); | 66 | void startClicked(); |
65 | void stopClicked(); | 67 | void stopClicked(); |
66 | 68 | ||
67 | void joinNetwork(const QString&,const QString&,int,const QString&); | 69 | void joinNetwork(const QString&,const QString&,int,const QString&); |
68 | 70 | ||
69 | signals: | 71 | signals: |
70 | void startedSniffing(); | 72 | void startedSniffing(); |
71 | void stoppedSniffing(); | 73 | void stoppedSniffing(); |
72 | 74 | ||
73 | private: | 75 | private: |
74 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); | 76 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); |
75 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); | 77 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); |
76 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); | 78 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); |
77 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); | 79 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); |
78 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); | 80 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); |
79 | void handleNotification( OPacket* p ); | 81 | void handleNotification( OPacket* p ); |
80 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | 82 | void doAction( const QString& action, const QString& protocol, OPacket* p ); |
81 | QObject* childIfToParse( OPacket* p, const QString& protocol ); | 83 | QObject* childIfToParse( OPacket* p, const QString& protocol ); |
82 | bool checkDumpPacket( OPacket* p ); | 84 | bool checkDumpPacket( OPacket* p ); |
83 | 85 | ||
84 | private: | 86 | private: |
85 | #ifdef QWS | 87 | #ifdef QWS |
86 | OSystem _system; // Opie Operating System identifier | 88 | OSystem _system; // Opie Operating System identifier |
87 | #endif | 89 | #endif |
88 | 90 | ||
89 | OWirelessNetworkInterface* iface; | 91 | OWirelessNetworkInterface* iface; |
90 | OPacketCapturer* pcap; | 92 | OPacketCapturer* pcap; |
91 | WellenreiterConfigWindow* configwindow; | 93 | WellenreiterConfigWindow* configwindow; |
92 | GPS* gps; | 94 | GPS* gps; |
93 | 95 | ||