summaryrefslogtreecommitdiff
path: root/noncore
authormickeyl <mickeyl>2003-05-02 22:27:24 (UTC)
committer mickeyl <mickeyl>2003-05-02 22:27:24 (UTC)
commit9325b8e82d2cf1df1233bcfb21d91f61f8e444a3 (patch) (unidiff)
treed9d32a0b47abeefe2f7d576db82ed45a1227caf3 /noncore
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') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp78
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h10
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp10
3 files changed, 70 insertions, 28 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,28 +191,12 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
191 191
192} 192}
193 193
194void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional )
195{
196 if ( type != "toDS" ) return;
197
198 qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)",
199 (const char*) type, (const char*) from,
200 (const char*) to, (const char*) via );
201
202 QString s;
203 MScanListItem* network;
204
205 QListViewItemIterator it( this );
206 while ( it.current() && it.current()->text( col_ap ) != via ) ++it;
207
208 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
209 194
210 if ( item ) // AP has been shown up, so just add our new "from" - station 195void MScanListView::addIfNotExisting( MScanListItem* network, QString addr )
211 { 196 {
212 network = static_cast<MScanListItem*>( item->parent() );
213 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 197 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
214 198
215 while ( subitem && ( subitem->text( col_ap ) != from ) ) 199 while ( subitem && ( subitem->text( col_ap ) != addr ) )
216 { 200 {
217 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); 201 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
218 subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); 202 subitem = static_cast<MScanListItem*> ( subitem->itemBelow() );
@@ -222,21 +206,71 @@ void MScanListView::traffic( QString type, QString from, QString to, QString via
222 { 206 {
223 // we have already seen this item, it's a dupe 207 // we have already seen this item, it's a dupe
224 #ifdef DEBUG 208 #ifdef DEBUG
225 qDebug( "%s is a dupe - ignoring...", (const char*) from ); 209 qDebug( "%s is a dupe - ignoring...", (const char*) addr );
226 #endif 210 #endif
227 subitem->receivedBeacon(); //FIXME: sent data bit 211 subitem->receivedBeacon(); //FIXME: sent data bit
228 return; 212 return;
229 } 213 }
230 214
231 // Hey, it seems to be a new item :-D 215 // Hey, it seems to be a new item :-D
232 MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); 216 MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 );
233 if ( _manufacturerdb ) 217 if ( _manufacturerdb )
234 station->setManufacturer( _manufacturerdb->lookup( from ) ); 218 station->setManufacturer( _manufacturerdb->lookup( addr ) );
219}
220
221
222void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo )
223{
224 QString s;
225 MScanListItem* network;
226
227 QListViewItemIterator it( this );
228 while ( it.current() &&
229 it.current()->text( col_ap ) != viaFrom &&
230 it.current()->text( col_ap ) != viaTo ) ++it;
231
232 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
233
234 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
235 {
236 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
237 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
235 } 238 }
236 else 239 else
237 { 240 {
238 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); 241 qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" );
242 }
239 } 243 }
244
245
246void MScanListView::toDStraffic( QString from, QString to, QString via )
247{
248 QString s;
249 MScanListItem* network;
250
251 QListViewItemIterator it( this );
252 while ( it.current() && it.current()->text( col_ap ) != via ) ++it;
253
254 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
255
256 if ( item ) // AP has shown up yet, so just add our new "from" - station
257 {
258 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
259 }
260 else
261 {
262 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
263 }
264}
265
266void MScanListView::fromDStraffic( QString from, QString to, QString via )
267{
268 qWarning( "D'oh! Not yet implemented..." );
269}
270
271void MScanListView::IBSStraffic( QString from, QString to, QString via )
272{
273 qWarning( "D'oh! Not yet implemented..." );
240} 274}
241 275
242//============================================================ 276//============================================================
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 @@
23class QString; 23class QString;
24class ManufacturerDB; 24class ManufacturerDB;
25 25
26class MScanListItem;
27
26class MScanListView: public OListView 28class MScanListView: public OListView
27{ 29{
28 Q_OBJECT 30 Q_OBJECT
@@ -39,7 +41,13 @@ class MScanListView: public OListView
39 41
40 public slots: 42 public slots:
41 void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 43 void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
42 void traffic( QString type, QString from, QString to, QString via, QString additional = QString::null ); 44 void fromDStraffic( QString from, QString to, QString via ); // NYI
45 void toDStraffic( QString from, QString to, QString via );
46 void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo );
47 void IBSStraffic( QString from, QString to, QString via ); // NYI
48
49 protected:
50 void addIfNotExisting( MScanListItem* parent, QString addr );
43 51
44 private: 52 private:
45 ManufacturerDB* _manufacturerdb; 53 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,7 +180,7 @@ void Wellenreiter::receivePacket(OPacket* p)
180 (const char*) wlan->macAddress3().toString(true), 180 (const char*) wlan->macAddress3().toString(true),
181 (const char*) wlan->macAddress1().toString(true), 181 (const char*) wlan->macAddress1().toString(true),
182 (const char*) wlan->macAddress2().toString(true) ); 182 (const char*) wlan->macAddress2().toString(true) );
183 netView()->traffic( "fromDS", wlan->macAddress3().toString(), 183 netView()->fromDStraffic( wlan->macAddress3().toString(),
184 wlan->macAddress1().toString(), 184 wlan->macAddress1().toString(),
185 wlan->macAddress2().toString() ); 185 wlan->macAddress2().toString() );
186 } 186 }
@@ -191,19 +191,19 @@ void Wellenreiter::receivePacket(OPacket* p)
191 (const char*) wlan->macAddress2().toString(true), 191 (const char*) wlan->macAddress2().toString(true),
192 (const char*) wlan->macAddress3().toString(true), 192 (const char*) wlan->macAddress3().toString(true),
193 (const char*) wlan->macAddress1().toString(true) ); 193 (const char*) wlan->macAddress1().toString(true) );
194 netView()->traffic( "toDS", wlan->macAddress2().toString(), 194 netView()->toDStraffic( wlan->macAddress2().toString(),
195 wlan->macAddress3().toString(), 195 wlan->macAddress3().toString(),
196 wlan->macAddress1().toString() ); 196 wlan->macAddress1().toString() );
197 } 197 }
198 else 198 else
199 if ( wlan->fromDS() && wlan->toDS() ) 199 if ( wlan->fromDS() && wlan->toDS() )
200 { 200 {
201 qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", 201 qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'",
202 (const char*) wlan->macAddress4().toString(true), 202 (const char*) wlan->macAddress4().toString(true),
203 (const char*) wlan->macAddress3().toString(true), 203 (const char*) wlan->macAddress3().toString(true),
204 (const char*) wlan->macAddress1().toString(true), 204 (const char*) wlan->macAddress1().toString(true),
205 (const char*) wlan->macAddress2().toString(true) ); 205 (const char*) wlan->macAddress2().toString(true) );
206 netView()->traffic( "WSD", wlan->macAddress4().toString(), 206 netView()->WDStraffic( wlan->macAddress4().toString(),
207 wlan->macAddress3().toString(), 207 wlan->macAddress3().toString(),
208 wlan->macAddress1().toString(), 208 wlan->macAddress1().toString(),
209 wlan->macAddress2().toString() ); 209 wlan->macAddress2().toString() );
@@ -214,7 +214,7 @@ void Wellenreiter::receivePacket(OPacket* p)
214 (const char*) wlan->macAddress2().toString(true), 214 (const char*) wlan->macAddress2().toString(true),
215 (const char*) wlan->macAddress1().toString(true), 215 (const char*) wlan->macAddress1().toString(true),
216 (const char*) wlan->macAddress3().toString(true) ); 216 (const char*) wlan->macAddress3().toString(true) );
217 netView()->traffic( "IBSS", wlan->macAddress2().toString(), 217 netView()->IBSStraffic( wlan->macAddress2().toString(),
218 wlan->macAddress1().toString(), 218 wlan->macAddress1().toString(),
219 wlan->macAddress3().toString() ); 219 wlan->macAddress3().toString() );
220 } 220 }