author | mickeyl <mickeyl> | 2004-01-06 20:23:34 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-06 20:23:34 (UTC) |
commit | a513de3ae1549428595db1b6c70e4203b0a3dedd (patch) (unidiff) | |
tree | bc6838aad156f2cb499ce69d1703d4c33839cfba /noncore | |
parent | 543c349726a63798491e85cf0dda89e79c6183d1 (diff) | |
download | opie-a513de3ae1549428595db1b6c70e4203b0a3dedd.zip opie-a513de3ae1549428595db1b6c70e4203b0a3dedd.tar.gz opie-a513de3ae1549428595db1b6c70e4203b0a3dedd.tar.bz2 |
display stations sending control frames
-rw-r--r-- | noncore/net/wellenreiter/ChangeLog | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 41 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 4 |
3 files changed, 38 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog index 755ed76..8bf8cc8 100644 --- a/noncore/net/wellenreiter/ChangeLog +++ b/noncore/net/wellenreiter/ChangeLog | |||
@@ -1,8 +1,9 @@ | |||
1 | 2004-??-?? Michael Lauer <mickey@Vanille.de> | 1 | 2004-??-?? Michael Lauer <mickey@Vanille.de> |
2 | 2 | ||
3 | * Added parsing of control frames. Display stations sending them SSID "???" for now. | ||
3 | * Added command line option "-nocheck" to skip non-root and dhcp tests | 4 | * Added command line option "-nocheck" to skip non-root and dhcp tests |
4 | * Improved the speed reading the manufacturer list | 5 | * Improved the speed reading the manufacturer list |
5 | * GPS coordinates are now presented in the DMS (as opposed to decimal) format | 6 | * GPS coordinates are now presented in the DMS (as opposed to decimal) format |
6 | 7 | ||
7 | 2003-12-18 Michael Lauer <mickey@Vanille.de> | 8 | 2003-12-18 Michael Lauer <mickey@Vanille.de> |
8 | 9 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 5575d6e..45d7142 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -156,14 +156,18 @@ void Wellenreiter::handleNotification( OPacket* p ) | |||
156 | } | 156 | } |
157 | ++it; | 157 | ++it; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
163 | { | 163 | { |
164 | if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time | ||
165 | |||
166 | OWaveLanManagementPacket* beacon = manage; | ||
167 | |||
164 | QString type; | 168 | QString type; |
165 | if ( beacon->canIBSS() ) | 169 | if ( beacon->canIBSS() ) |
166 | { | 170 | { |
167 | type = "adhoc"; | 171 | type = "adhoc"; |
168 | } | 172 | } |
169 | else if ( beacon->canESS() ) | 173 | else if ( beacon->canESS() ) |
@@ -180,13 +184,13 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
180 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 184 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
181 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
182 | int channel = ds ? ds->channel() : -1; | 186 | int channel = ds ? ds->channel() : -1; |
183 | 187 | ||
184 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
185 | 189 | ||
186 | GpsLocation loc( 0, 0 ); | 190 | GpsLocation loc( -111.111, -111.111 ); |
187 | if ( configwindow->enableGPS->isChecked() ) | 191 | if ( configwindow->enableGPS->isChecked() ) |
188 | { | 192 | { |
189 | // TODO: add check if GPS is working!? | 193 | // TODO: add check if GPS is working!? |
190 | qDebug( "Wellenreiter::gathering GPS data..." ); | 194 | qDebug( "Wellenreiter::gathering GPS data..." ); |
191 | loc = gps->position(); | 195 | loc = gps->position(); |
192 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 196 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
@@ -203,12 +207,27 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
203 | else | 207 | else |
204 | graphwindow->traffic( ds->channel(), 95 ); | 208 | graphwindow->traffic( ds->channel(), 95 ); |
205 | } | 209 | } |
206 | } | 210 | } |
207 | 211 | ||
208 | 212 | ||
213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | ||
214 | { | ||
215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | ||
216 | |||
217 | if ( control->controlType() == "Acknowledge" ) | ||
218 | { | ||
219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) ); | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | |||
209 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
210 | { | 229 | { |
211 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
212 | if ( wlan->fromDS() && !wlan->toDS() ) | 231 | if ( wlan->fromDS() && !wlan->toDS() ) |
213 | { | 232 | { |
214 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 233 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
@@ -238,13 +257,13 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd | |||
238 | 257 | ||
239 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | 258 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) |
240 | { | 259 | { |
241 | from = data->sourceAddress(); | 260 | from = data->sourceAddress(); |
242 | to = data->destinationAddress(); | 261 | to = data->destinationAddress(); |
243 | 262 | ||
244 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) ); | 263 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) ); |
245 | } | 264 | } |
246 | 265 | ||
247 | 266 | ||
248 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) | 267 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) |
249 | { | 268 | { |
250 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 269 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
@@ -337,17 +356,25 @@ void Wellenreiter::receivePacket( OPacket* p ) | |||
337 | 356 | ||
338 | if ( checkDumpPacket( p ) ) | 357 | if ( checkDumpPacket( p ) ) |
339 | { | 358 | { |
340 | pcap->dump( p ); | 359 | pcap->dump( p ); |
341 | } | 360 | } |
342 | 361 | ||
343 | // check if we received a beacon frame | 362 | // check for a management frame |
344 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); | 363 | OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); |
345 | if ( beacon && beacon->managementType() == "Beacon" ) | 364 | if ( manage ) |
365 | { | ||
366 | handleManagementFrame( p, manage ); | ||
367 | return; | ||
368 | } | ||
369 | |||
370 | // check for a control frame | ||
371 | OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) ); | ||
372 | if ( control ) | ||
346 | { | 373 | { |
347 | handleBeacon( p, beacon ); | 374 | handleControlFrame( p, control ); |
348 | return; | 375 | return; |
349 | } | 376 | } |
350 | 377 | ||
351 | OMacAddress source; | 378 | OMacAddress source; |
352 | OMacAddress dest; | 379 | OMacAddress dest; |
353 | 380 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 58dd1fd..5414fda 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -24,12 +24,13 @@ using namespace Opie; | |||
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | class QTimerEvent; | 26 | class QTimerEvent; |
27 | class QPixmap; | 27 | class QPixmap; |
28 | class OPacket; | 28 | class OPacket; |
29 | class OWaveLanManagementPacket; | 29 | class OWaveLanManagementPacket; |
30 | class OWaveLanControlPacket; | ||
30 | class OWaveLanDataPacket; | 31 | class OWaveLanDataPacket; |
31 | class OEthernetPacket; | 32 | class OEthernetPacket; |
32 | class OARPPacket; | 33 | class OARPPacket; |
33 | class OMacAddress; | 34 | class OMacAddress; |
34 | class OIPPacket; | 35 | class OIPPacket; |
35 | class OPacketCapturer; | 36 | class OPacketCapturer; |
@@ -71,13 +72,14 @@ class Wellenreiter : public WellenreiterBase { | |||
71 | 72 | ||
72 | signals: | 73 | signals: |
73 | void startedSniffing(); | 74 | void startedSniffing(); |
74 | void stoppedSniffing(); | 75 | void stoppedSniffing(); |
75 | 76 | ||
76 | private: | 77 | private: |
77 | void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); | 78 | void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ); |
79 | void handleControlFrame( OPacket* p, OWaveLanControlPacket* control ); | ||
78 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); | 80 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); |
79 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); | 81 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); |
80 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); | 82 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); |
81 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); | 83 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); |
82 | void handleNotification( OPacket* p ); | 84 | void handleNotification( OPacket* p ); |
83 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | 85 | void doAction( const QString& action, const QString& protocol, OPacket* p ); |