summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui
authormickeyl <mickeyl>2003-05-02 22:27:24 (UTC)
committer mickeyl <mickeyl>2003-05-02 22:27:24 (UTC)
commit9325b8e82d2cf1df1233bcfb21d91f61f8e444a3 (patch) (side-by-side diff)
treed9d32a0b47abeefe2f7d576db82ed45a1227caf3 /noncore/net/wellenreiter/gui
parent0a7f622dd6e9b37a52c7a4b2382d4c3486326c3f (diff)
downloadopie-9325b8e82d2cf1df1233bcfb21d91f61f8e444a3.zip
opie-9325b8e82d2cf1df1233bcfb21d91f61f8e444a3.tar.gz
opie-9325b8e82d2cf1df1233bcfb21d91f61f8e444a3.tar.bz2
start to parse and interpretate WDS (bridging) data and thus additionally display stationary systems
Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp90
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h10
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp28
3 files changed, 85 insertions, 43 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index a8cadd8..7733934 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -191,54 +191,88 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
}
-void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional )
+
+void MScanListView::addIfNotExisting( MScanListItem* network, QString addr )
{
- if ( type != "toDS" ) return;
+ MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
+
+ while ( subitem && ( subitem->text( col_ap ) != addr ) )
+ {
+ 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*) addr );
+ #endif
+ subitem->receivedBeacon(); //FIXME: sent data bit
+ return;
+ }
+
+ // Hey, it seems to be a new item :-D
+ MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 );
+ if ( _manufacturerdb )
+ station->setManufacturer( _manufacturerdb->lookup( addr ) );
+}
- qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)",
- (const char*) type, (const char*) from,
- (const char*) to, (const char*) via );
+void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo )
+{
QString s;
MScanListItem* network;
QListViewItemIterator it( this );
- while ( it.current() && it.current()->text( col_ap ) != via ) ++it;
+ while ( it.current() &&
+ it.current()->text( col_ap ) != viaFrom &&
+ it.current()->text( col_ap ) != viaTo ) ++it;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
- if ( item ) // AP has been shown up, so just add our new "from" - station
+ if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
+ {
+ addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
+ addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
+ }
+ else
{
- network = static_cast<MScanListItem*>( item->parent() );
- MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
+ qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" );
+ }
+}
- 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;
- }
+void MScanListView::toDStraffic( QString from, QString to, QString 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() );
- // 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 ) );
+ if ( item ) // AP has shown up yet, so just add our new "from" - station
+ {
+ addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
}
else
{
- qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" );
+ qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
}
}
+void MScanListView::fromDStraffic( QString from, QString to, QString via )
+{
+ qWarning( "D'oh! Not yet implemented..." );
+}
+
+void MScanListView::IBSStraffic( QString from, QString to, QString via )
+{
+ qWarning( "D'oh! Not yet implemented..." );
+}
+
//============================================================
// MScanListItem
//============================================================
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index bed69f1..a14d426 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -23,6 +23,8 @@
class QString;
class ManufacturerDB;
+class MScanListItem;
+
class MScanListView: public OListView
{
Q_OBJECT
@@ -39,7 +41,13 @@ 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 );
+ void fromDStraffic( QString from, QString to, QString via ); // NYI
+ void toDStraffic( QString from, QString to, QString via );
+ void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo );
+ void IBSStraffic( QString from, QString to, QString via ); // NYI
+
+ protected:
+ void addIfNotExisting( MScanListItem* parent, QString addr );
private:
ManufacturerDB* _manufacturerdb;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 5ec9ee4..4b82c9a 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -180,9 +180,9 @@ void Wellenreiter::receivePacket(OPacket* p)
(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() );
+ netView()->fromDStraffic( wlan->macAddress3().toString(),
+ wlan->macAddress1().toString(),
+ wlan->macAddress2().toString() );
}
else
if ( !wlan->fromDS() && wlan->toDS() )
@@ -191,22 +191,22 @@ void Wellenreiter::receivePacket(OPacket* p)
(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() );
+ netView()->toDStraffic( 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'",
+ qDebug( "WDS(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() );
+ netView()->WDStraffic( wlan->macAddress4().toString(),
+ wlan->macAddress3().toString(),
+ wlan->macAddress1().toString(),
+ wlan->macAddress2().toString() );
}
else
{
@@ -214,9 +214,9 @@ void Wellenreiter::receivePacket(OPacket* p)
(const char*) wlan->macAddress2().toString(true),
(const char*) wlan->macAddress1().toString(true),
(const char*) wlan->macAddress3().toString(true) );
- netView()->traffic( "IBSS", wlan->macAddress2().toString(),
- wlan->macAddress1().toString(),
- wlan->macAddress3().toString() );
+ netView()->IBSStraffic( wlan->macAddress2().toString(),
+ wlan->macAddress1().toString(),
+ wlan->macAddress3().toString() );
}
return;
}