From a513de3ae1549428595db1b6c70e4203b0a3dedd Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 06 Jan 2004 20:23:34 +0000 Subject: display stations sending control frames --- (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') 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 @@ -159,8 +159,12 @@ void Wellenreiter::handleNotification( OPacket* p ) } -void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) +void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) { + if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time + + OWaveLanManagementPacket* beacon = manage; + QString type; if ( beacon->canIBSS() ) { @@ -183,7 +187,7 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) OWaveLanPacket* header = static_cast( p->child( "802.11" ) ); - GpsLocation loc( 0, 0 ); + GpsLocation loc( -111.111, -111.111 ); if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? @@ -206,6 +210,21 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) } +void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) +{ + OWaveLanPacket* header = static_cast( p->child( "802.11" ) ); + + if ( control->controlType() == "Acknowledge" ) + { + netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) ); + } + else + { + qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); + } +} + + void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); @@ -241,7 +260,7 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd from = data->sourceAddress(); to = data->destinationAddress(); - netView()->addNewItem( "station", "", from, false, -1, 0, GpsLocation( 0, 0 ) ); + netView()->addNewItem( "station", "", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) ); } @@ -340,11 +359,19 @@ void Wellenreiter::receivePacket( OPacket* p ) pcap->dump( p ); } - // check if we received a beacon frame - OWaveLanManagementPacket* beacon = static_cast( childIfToParse( p, "802.11 Management" ) ); - if ( beacon && beacon->managementType() == "Beacon" ) + // check for a management frame + OWaveLanManagementPacket* manage = static_cast( childIfToParse( p, "802.11 Management" ) ); + if ( manage ) + { + handleManagementFrame( p, manage ); + return; + } + + // check for a control frame + OWaveLanControlPacket* control = static_cast( childIfToParse( p, "802.11 Control" ) ); + if ( control ) { - handleBeacon( p, beacon ); + handleControlFrame( p, control ); return; } -- cgit v0.9.0.2