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 | |||
@@ -47 +47,19 @@ contains( platform, x11 ) { | |||
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 | |||
@@ -19,2 +19,4 @@ | |||
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 ) |
@@ -24,2 +26,4 @@ MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) | |||
24 | ledit->setReadOnly( true ); | 26 | ledit->setReadOnly( true ); |
27 | |||
28 | MLogWindow::_instance = this; | ||
25 | } | 29 | } |
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 | |||
@@ -33,2 +33,4 @@ class MLogWindow: public QVBox | |||
33 | 33 | ||
34 | static MLogWindow* logwindow() { return MLogWindow::_instance; }; | ||
35 | |||
34 | protected: | 36 | protected: |
@@ -36,2 +38,5 @@ class MLogWindow: public QVBox | |||
36 | 38 | ||
39 | private: | ||
40 | static MLogWindow* _instance; | ||
41 | |||
37 | }; | 42 | }; |
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 | |||
@@ -134,7 +134,7 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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 | ||
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 | |||
@@ -17,2 +17,3 @@ | |||
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "logwindow.h" | ||
18 | 19 | ||
@@ -42,5 +43,6 @@ 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 | ||
@@ -54,19 +56,21 @@ MScanListView::MScanListView( QWidget* parent, const char* name ) | |||
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 ); |
@@ -105,7 +109,6 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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 | ||
@@ -119,3 +122,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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() ); |
@@ -133,3 +138,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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() ); |
@@ -149,4 +156,4 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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 ); |
@@ -158,3 +165,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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 | ||
@@ -166,3 +175,3 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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 | } |
@@ -170,5 +179,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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 | ||
@@ -183,3 +192,5 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons | |||
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() ); |
@@ -205,3 +216,3 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons | |||
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 | } |
@@ -209,5 +220,5 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons | |||
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 | } |
@@ -235,2 +246,3 @@ void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QStri | |||
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 | } |
@@ -256,2 +268,4 @@ void MScanListView::toDStraffic( QString from, QString to, QString via ) | |||
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 | } |
@@ -259,2 +273,3 @@ void MScanListView::toDStraffic( QString from, QString to, QString via ) | |||
259 | 273 | ||
274 | |||
260 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) | 275 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) |
@@ -276,2 +291,3 @@ void MScanListView::fromDStraffic( QString from, QString to, QString via ) | |||
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 | } |
@@ -279,2 +295,3 @@ void MScanListView::fromDStraffic( QString from, QString to, QString via ) | |||
279 | 295 | ||
296 | |||
280 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) | 297 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) |
@@ -282,4 +299,25 @@ void MScanListView::IBSStraffic( QString from, QString to, QString via ) | |||
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 | //============================================================ |
@@ -294,3 +332,5 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS | |||
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" ) |
@@ -304,3 +344,5 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid | |||
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 ); |
@@ -315,3 +357,5 @@ 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 ); |
@@ -324,3 +368,5 @@ 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 ); |
@@ -342,2 +388,3 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
342 | { | 388 | { |
389 | #ifdef DEBUG | ||
343 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 390 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
@@ -347,2 +394,3 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
347 | channel ); | 394 | channel ); |
395 | #endif | ||
348 | 396 | ||
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 | |||
@@ -48,2 +48,4 @@ class MScanListView: public OListView | |||
48 | 48 | ||
49 | void identify( const QString& macaddr, const QString& ipaddr ); | ||
50 | |||
49 | protected: | 51 | protected: |
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 | |||
@@ -139,42 +139,119 @@ void Wellenreiter::channelHopped(int c) | |||
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; |
@@ -182,2 +259,4 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
182 | 259 | ||
260 | //TODO: WEP check here | ||
261 | |||
183 | // check for a data frame | 262 | // check for a data frame |
@@ -186,48 +265,3 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
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 | } |
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 | |||
@@ -28,5 +28,6 @@ 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; |
@@ -65,2 +66,6 @@ class Wellenreiter : public WellenreiterBase { | |||
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 |