author | mickeyl <mickeyl> | 2003-05-10 17:03:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-10 17:03:50 (UTC) |
commit | e858fffe853c2893775c202c52ba1d4898e723bc (patch) (unidiff) | |
tree | 6d5bbe5ff471d12c89fd1e6d04458477fb1292d3 /noncore/net/wellenreiter/gui/wellenreiter.cpp | |
parent | e9195d3c80eca6ca41893ddcfef46683da6c5627 (diff) | |
download | opie-e858fffe853c2893775c202c52ba1d4898e723bc.zip opie-e858fffe853c2893775c202c52ba1d4898e723bc.tar.gz opie-e858fffe853c2893775c202c52ba1d4898e723bc.tar.bz2 |
- use OManufacturerDB instead of ManufacturerDB
- misc fixes
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 74 |
1 files changed, 12 insertions, 62 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4257be1..2f26702 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -21,9 +21,8 @@ | |||
21 | #include "hexwindow.h" | 21 | #include "hexwindow.h" |
22 | #include "configwindow.h" | 22 | #include "configwindow.h" |
23 | #include "statwindow.h" | 23 | #include "statwindow.h" |
24 | #include "graphwindow.h" | 24 | #include "graphwindow.h" |
25 | #include "manufacturers.h" | ||
26 | #include "protolistview.h" | 25 | #include "protolistview.h" |
27 | 26 | ||
28 | // Opie | 27 | // Opie |
29 | 28 | ||
@@ -64,23 +63,11 @@ using namespace Opie; | |||
64 | #include <stdlib.h> | 63 | #include <stdlib.h> |
65 | 64 | ||
66 | Wellenreiter::Wellenreiter( QWidget* parent ) | 65 | Wellenreiter::Wellenreiter( QWidget* parent ) |
67 | : WellenreiterBase( parent, 0, 0 ), | 66 | : WellenreiterBase( parent, 0, 0 ), |
68 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) | 67 | sniffing( false ), iface( 0 ), configwindow( 0 ) |
69 | { | 68 | { |
70 | 69 | ||
71 | // | ||
72 | // construct manufacturer database | ||
73 | // | ||
74 | |||
75 | QString manufile; | ||
76 | #ifdef QWS | ||
77 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | ||
78 | #else | ||
79 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); | ||
80 | #endif | ||
81 | manufacturerdb = new ManufacturerDB( manufile ); | ||
82 | |||
83 | logwindow->log( "(i) Wellenreiter has been started." ); | 70 | logwindow->log( "(i) Wellenreiter has been started." ); |
84 | 71 | ||
85 | // | 72 | // |
86 | // detect operating system | 73 | // detect operating system |
@@ -92,24 +79,15 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
92 | _system = ODevice::inst()->system(); | 79 | _system = ODevice::inst()->system(); |
93 | logwindow->log( sys ); | 80 | logwindow->log( sys ); |
94 | #endif | 81 | #endif |
95 | 82 | ||
96 | // setup GUI | ||
97 | netview->setColumnWidthMode( 1, QListView::Manual ); | 83 | netview->setColumnWidthMode( 1, QListView::Manual ); |
98 | |||
99 | if ( manufacturerdb ) | ||
100 | netview->setManufacturerDB( manufacturerdb ); | ||
101 | |||
102 | pcap = new OPacketCapturer(); | 84 | pcap = new OPacketCapturer(); |
103 | |||
104 | } | 85 | } |
105 | 86 | ||
106 | 87 | ||
107 | Wellenreiter::~Wellenreiter() | 88 | Wellenreiter::~Wellenreiter() |
108 | { | 89 | { |
109 | // no need to delete child widgets, Qt does it all for us | ||
110 | |||
111 | delete manufacturerdb; | ||
112 | delete pcap; | 90 | delete pcap; |
113 | } | 91 | } |
114 | 92 | ||
115 | 93 | ||
@@ -185,9 +163,9 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 163 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
186 | int channel = ds ? ds->channel() : -1; | 164 | int channel = ds ? ds->channel() : -1; |
187 | 165 | ||
188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 166 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
189 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); | 167 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); |
190 | 168 | ||
191 | // update graph window | 169 | // update graph window |
192 | if ( ds ) | 170 | if ( ds ) |
193 | { | 171 | { |
@@ -204,63 +182,35 @@ void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | |||
204 | { | 182 | { |
205 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 183 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
206 | if ( wlan->fromDS() && !wlan->toDS() ) | 184 | if ( wlan->fromDS() && !wlan->toDS() ) |
207 | { | 185 | { |
208 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | 186 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
209 | (const char*) wlan->macAddress3().toString(true), | ||
210 | (const char*) wlan->macAddress1().toString(true), | ||
211 | (const char*) wlan->macAddress2().toString(true) ); | ||
212 | netView()->fromDStraffic( wlan->macAddress3().toString(), | ||
213 | wlan->macAddress1().toString(), | ||
214 | wlan->macAddress2().toString() ); | ||
215 | } | 187 | } |
216 | else | 188 | else if ( !wlan->fromDS() && wlan->toDS() ) |
217 | if ( !wlan->fromDS() && wlan->toDS() ) | ||
218 | { | 189 | { |
219 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", | 190 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
220 | (const char*) wlan->macAddress2().toString(true), | ||
221 | (const char*) wlan->macAddress3().toString(true), | ||
222 | (const char*) wlan->macAddress1().toString(true) ); | ||
223 | netView()->toDStraffic( wlan->macAddress2().toString(), | ||
224 | wlan->macAddress3().toString(), | ||
225 | wlan->macAddress1().toString() ); | ||
226 | } | 191 | } |
227 | else | 192 | else if ( wlan->fromDS() && wlan->toDS() ) |
228 | if ( wlan->fromDS() && wlan->toDS() ) | ||
229 | { | 193 | { |
230 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | 194 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
231 | (const char*) wlan->macAddress4().toString(true), | ||
232 | (const char*) wlan->macAddress3().toString(true), | ||
233 | (const char*) wlan->macAddress1().toString(true), | ||
234 | (const char*) wlan->macAddress2().toString(true) ); | ||
235 | netView()->WDStraffic( wlan->macAddress4().toString(), | ||
236 | wlan->macAddress3().toString(), | ||
237 | wlan->macAddress1().toString(), | ||
238 | wlan->macAddress2().toString() ); | ||
239 | } | 195 | } |
240 | else | 196 | else |
241 | { | 197 | { |
242 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", | 198 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
243 | (const char*) wlan->macAddress2().toString(true), | ||
244 | (const char*) wlan->macAddress1().toString(true), | ||
245 | (const char*) wlan->macAddress3().toString(true) ); | ||
246 | netView()->IBSStraffic( wlan->macAddress2().toString(), | ||
247 | wlan->macAddress1().toString(), | ||
248 | wlan->macAddress3().toString() ); | ||
249 | } | 199 | } |
250 | 200 | ||
251 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 201 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
252 | if ( arp ) | 202 | if ( arp ) |
253 | { | 203 | { |
254 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 204 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
255 | if ( arp->type() == "REQUEST" ) | 205 | if ( arp->type() == "REQUEST" ) |
256 | { | 206 | { |
257 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); | 207 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
258 | } | 208 | } |
259 | else if ( arp->type() == "REPLY" ) | 209 | else if ( arp->type() == "REPLY" ) |
260 | { | 210 | { |
261 | netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); | 211 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
262 | netView()->identify( arp->targetMacAddress().toString(), arp->targetIPV4Address().toString() ); | 212 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
263 | } | 213 | } |
264 | } | 214 | } |
265 | 215 | ||
266 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); | 216 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); |
@@ -436,9 +386,9 @@ void Wellenreiter::startClicked() | |||
436 | iface->setMonitorMode( true ); | 386 | iface->setMonitorMode( true ); |
437 | if ( !iface->monitorMode() ) | 387 | if ( !iface->monitorMode() ) |
438 | { | 388 | { |
439 | QMessageBox::warning( this, "Wellenreiter II", | 389 | QMessageBox::warning( this, "Wellenreiter II", |
440 | tr( "Can't set interface '%1' into monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); | 390 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); |
441 | return; | 391 | return; |
442 | } | 392 | } |
443 | } | 393 | } |
444 | 394 | ||