author | mickeyl <mickeyl> | 2003-05-02 22:27:24 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-02 22:27:24 (UTC) |
commit | 9325b8e82d2cf1df1233bcfb21d91f61f8e444a3 (patch) (unidiff) | |
tree | d9d32a0b47abeefe2f7d576db82ed45a1227caf3 | |
parent | 0a7f622dd6e9b37a52c7a4b2382d4c3486326c3f (diff) | |
download | opie-9325b8e82d2cf1df1233bcfb21d91f61f8e444a3.zip opie-9325b8e82d2cf1df1233bcfb21d91f61f8e444a3.tar.gz opie-9325b8e82d2cf1df1233bcfb21d91f61f8e444a3.tar.bz2 |
start to parse and interpretate WDS (bridging) data and thus additionally display stationary systems
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 90 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 28 |
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 | |||
191 | 191 | ||
192 | } | 192 | } |
193 | 193 | ||
194 | void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) | 194 | |
195 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) | ||
195 | { | 196 | { |
196 | if ( type != "toDS" ) return; | 197 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
198 | |||
199 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) | ||
200 | { | ||
201 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | ||
202 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); | ||
203 | } | ||
204 | |||
205 | if ( subitem ) | ||
206 | { | ||
207 | // we have already seen this item, it's a dupe | ||
208 | #ifdef DEBUG | ||
209 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); | ||
210 | #endif | ||
211 | subitem->receivedBeacon(); //FIXME: sent data bit | ||
212 | return; | ||
213 | } | ||
214 | |||
215 | // Hey, it seems to be a new item :-D | ||
216 | MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 ); | ||
217 | if ( _manufacturerdb ) | ||
218 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); | ||
219 | } | ||
197 | 220 | ||
198 | qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", | ||
199 | (const char*) type, (const char*) from, | ||
200 | (const char*) to, (const char*) via ); | ||
201 | 221 | ||
222 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) | ||
223 | { | ||
202 | QString s; | 224 | QString s; |
203 | MScanListItem* network; | 225 | MScanListItem* network; |
204 | 226 | ||
205 | QListViewItemIterator it( this ); | 227 | QListViewItemIterator it( this ); |
206 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 228 | while ( it.current() && |
229 | it.current()->text( col_ap ) != viaFrom && | ||
230 | it.current()->text( col_ap ) != viaTo ) ++it; | ||
207 | 231 | ||
208 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 232 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
209 | 233 | ||
210 | if ( item ) // AP has been shown up, so just add our new "from" - station | 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 ); | ||
238 | } | ||
239 | else | ||
211 | { | 240 | { |
212 | network = static_cast<MScanListItem*>( item->parent() ); | 241 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
213 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 242 | } |
243 | } | ||
214 | 244 | ||
215 | while ( subitem && ( subitem->text( col_ap ) != from ) ) | ||
216 | { | ||
217 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | ||
218 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); | ||
219 | } | ||
220 | 245 | ||
221 | if ( subitem ) | 246 | void MScanListView::toDStraffic( QString from, QString to, QString via ) |
222 | { | 247 | { |
223 | // we have already seen this item, it's a dupe | 248 | QString s; |
224 | #ifdef DEBUG | 249 | MScanListItem* network; |
225 | qDebug( "%s is a dupe - ignoring...", (const char*) from ); | 250 | |
226 | #endif | 251 | QListViewItemIterator it( this ); |
227 | subitem->receivedBeacon(); //FIXME: sent data bit | 252 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
228 | return; | 253 | |
229 | } | 254 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
230 | 255 | ||
231 | // Hey, it seems to be a new item :-D | 256 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
232 | MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); | 257 | { |
233 | if ( _manufacturerdb ) | 258 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
234 | station->setManufacturer( _manufacturerdb->lookup( from ) ); | ||
235 | } | 259 | } |
236 | else | 260 | else |
237 | { | 261 | { |
238 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); | 262 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
239 | } | 263 | } |
240 | } | 264 | } |
241 | 265 | ||
266 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) | ||
267 | { | ||
268 | qWarning( "D'oh! Not yet implemented..." ); | ||
269 | } | ||
270 | |||
271 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) | ||
272 | { | ||
273 | qWarning( "D'oh! Not yet implemented..." ); | ||
274 | } | ||
275 | |||
242 | //============================================================ | 276 | //============================================================ |
243 | // MScanListItem | 277 | // MScanListItem |
244 | //============================================================ | 278 | //============================================================ |
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 @@ | |||
23 | class QString; | 23 | class QString; |
24 | class ManufacturerDB; | 24 | class ManufacturerDB; |
25 | 25 | ||
26 | class MScanListItem; | ||
27 | |||
26 | class MScanListView: public OListView | 28 | class 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,9 +180,9 @@ 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 | } |
187 | else | 187 | else |
188 | if ( !wlan->fromDS() && wlan->toDS() ) | 188 | if ( !wlan->fromDS() && wlan->toDS() ) |
@@ -191,22 +191,22 @@ 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() ); |
210 | } | 210 | } |
211 | else | 211 | else |
212 | { | 212 | { |
@@ -214,9 +214,9 @@ 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 | } |
221 | return; | 221 | return; |
222 | } | 222 | } |