summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-07 22:06:01 (UTC)
committer mickeyl <mickeyl>2003-04-07 22:06:01 (UTC)
commiteee5531d24fdb17011debaa7acd42683330e55b6 (patch) (side-by-side diff)
tree5e82bb5e7c39b1bdb1240eff47dbbe13adcf18cb
parentc32ffdaa4cac3cbe60d4bb6f72e0444a6f9e323f (diff)
downloadopie-eee5531d24fdb17011debaa7acd42683330e55b6.zip
opie-eee5531d24fdb17011debaa7acd42683330e55b6.tar.gz
opie-eee5531d24fdb17011debaa7acd42683330e55b6.tar.bz2
New feature! Finally, non-AP stations in an infrastructure network show up.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp85
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp88
3 files changed, 138 insertions, 36 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 34c69f5..1525934 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -26,6 +26,24 @@
using namespace Opie;
#endif
+
+#ifdef QWS
+#include <qpe/resource.h>
+#else
+#include "resource.h"
+#endif
+
+const int col_type = 0;
+const int col_essid = 0;
+const int col_sig = 1;
+const int col_ap = 2;
+const int col_channel = 3;
+const int col_wep = 4;
+const int col_traffic = 5;
+const int col_manuf = 6;
+const int col_firstseen = 7;
+const int col_lastseen = 8;
+
MScanListView::MScanListView( QWidget* parent, const char* name )
:OListView( parent, name ), _manufacturerdb( 0 )
{
@@ -105,7 +123,7 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
if ( item )
{
// animate the item
-
+
/*
const QPixmap* pixmap = item->pixmap( 0 );
@@ -173,22 +191,57 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
}
-#ifdef QWS
-#include <qpe/resource.h>
-#else
-#include "resource.h"
-#endif
+void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional )
+{
+ if ( type != "toDS" ) return;
-const int col_type = 0;
-const int col_essid = 0;
-const int col_sig = 1;
-const int col_ap = 2;
-const int col_channel = 3;
-const int col_wep = 4;
-const int col_traffic = 5;
-const int col_manuf = 6;
-const int col_firstseen = 7;
-const int col_lastseen = 8;
+ qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)",
+ (const char*) type, (const char*) from,
+ (const char*) to, (const char*) via );
+
+ QString s;
+ MScanListItem* network;
+
+ QListViewItemIterator it( this );
+ while ( it.current() && it.current()->text( col_ap ) != via ) ++it;
+
+ MScanListItem* item = static_cast<MScanListItem*>( it.current() );
+
+ if ( item ) // AP has been shown up, so just add our new "from" - station
+ {
+ network = static_cast<MScanListItem*>( item->parent() );
+ MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
+
+ while ( subitem && ( subitem->text( col_ap ) != from ) )
+ {
+ qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
+ subitem = static_cast<MScanListItem*> ( subitem->itemBelow() );
+ }
+
+ if ( subitem )
+ {
+ // we have already seen this item, it's a dupe
+ #ifdef DEBUG
+ qDebug( "%s is a dupe - ignoring...", (const char*) from );
+ #endif
+ subitem->receivedBeacon(); //FIXME: sent data bit
+ return;
+ }
+
+ // Hey, it seems to be a new item :-D
+ MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 );
+ if ( _manufacturerdb )
+ station->setManufacturer( _manufacturerdb->lookup( from ) );
+ }
+ else
+ {
+ qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" );
+ }
+}
+
+//============================================================
+// MScanListItem
+//============================================================
MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
bool wep, int channel, int signal )
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 01db172..bed69f1 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -39,6 +39,7 @@ class MScanListView: public OListView
public slots:
void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
+ void traffic( QString type, QString from, QString to, QString via, QString additional = QString::null );
private:
ManufacturerDB* _manufacturerdb;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index aa33158..8d18f73 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -113,28 +113,76 @@ void Wellenreiter::receivePacket(OPacket* p)
hexWindow()->log( p->dump( 8 ) );
// check if we received a beacon frame
- // static_cast is justified here
OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
- if ( !beacon ) return;
- QString type;
-
- //FIXME: Can stations in ESS mode can be distinguished from APs?
- //FIXME: Apparently yes, but not by listening to beacons, because
- //FIXME: they simply don't send beacons in infrastructure mode.
- //FIXME: so we also have to listen to data packets
-
- if ( beacon->canIBSS() )
- type = "adhoc";
- else
- type = "managed";
-
- OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
- QString essid = ssid ? ssid->ID() : QString("<unknown>");
- OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
- int channel = ds ? ds->channel() : -1;
+ if ( beacon )
+ {
+ QString type;
+ if ( beacon->canIBSS() )
+ type = "adhoc";
+ else
+ type = "managed";
+
+ OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
+ QString essid = ssid ? ssid->ID() : QString("<unknown>");
+ OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
+ int channel = ds ? ds->channel() : -1;
+
+ OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
+ netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 );
+ return;
+ }
- OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
- netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 );
+ // check for a data frame
+ OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) );
+ if ( data )
+ {
+ OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
+ if ( wlan->fromDS() && !wlan->toDS() )
+ {
+ qDebug( "FromDS traffic: '%s' -> '%s' via '%s'",
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress2().toString(true) );
+ netView()->traffic( "fromDS", wlan->macAddress3().toString(),
+ wlan->macAddress1().toString(),
+ wlan->macAddress2().toString() );
+ }
+ else
+ if ( !wlan->fromDS() && wlan->toDS() )
+ {
+ qDebug( "ToDS traffic: '%s' -> '%s' via '%s'",
+ (const char*) wlan->macAddress2().toString(true),
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true) );
+ netView()->traffic( "toDS", wlan->macAddress2().toString(),
+ wlan->macAddress3().toString(),
+ wlan->macAddress1().toString() );
+ }
+ else
+ if ( wlan->fromDS() && wlan->toDS() )
+ {
+ qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'",
+ (const char*) wlan->macAddress4().toString(true),
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress2().toString(true) );
+ netView()->traffic( "WSD", wlan->macAddress4().toString(),
+ wlan->macAddress3().toString(),
+ wlan->macAddress1().toString(),
+ wlan->macAddress2().toString() );
+ }
+ else
+ {
+ qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'",
+ (const char*) wlan->macAddress2().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress3().toString(true) );
+ netView()->traffic( "fromDS", wlan->macAddress2().toString(),
+ wlan->macAddress1().toString(),
+ wlan->macAddress3().toString() );
+ }
+ return;
+ }
}
void Wellenreiter::startStopClicked()