author | mickeyl <mickeyl> | 2003-04-07 22:06:01 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-07 22:06:01 (UTC) |
commit | eee5531d24fdb17011debaa7acd42683330e55b6 (patch) (unidiff) | |
tree | 5e82bb5e7c39b1bdb1240eff47dbbe13adcf18cb | |
parent | c32ffdaa4cac3cbe60d4bb6f72e0444a6f9e323f (diff) | |
download | opie-eee5531d24fdb17011debaa7acd42683330e55b6.zip opie-eee5531d24fdb17011debaa7acd42683330e55b6.tar.gz opie-eee5531d24fdb17011debaa7acd42683330e55b6.tar.bz2 |
New feature! Finally, non-AP stations in an infrastructure network show up.
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 81 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 64 |
3 files changed, 124 insertions, 22 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 @@ | |||
26 | using namespace Opie; | 26 | using namespace Opie; |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | |||
30 | #ifdef QWS | ||
31 | #include <qpe/resource.h> | ||
32 | #else | ||
33 | #include "resource.h" | ||
34 | #endif | ||
35 | |||
36 | const int col_type = 0; | ||
37 | const int col_essid = 0; | ||
38 | const int col_sig = 1; | ||
39 | const int col_ap = 2; | ||
40 | const int col_channel = 3; | ||
41 | const int col_wep = 4; | ||
42 | const int col_traffic = 5; | ||
43 | const int col_manuf = 6; | ||
44 | const int col_firstseen = 7; | ||
45 | const int col_lastseen = 8; | ||
46 | |||
29 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 47 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
30 | :OListView( parent, name ), _manufacturerdb( 0 ) | 48 | :OListView( parent, name ), _manufacturerdb( 0 ) |
31 | { | 49 | { |
@@ -173,22 +191,57 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
173 | 191 | ||
174 | } | 192 | } |
175 | 193 | ||
176 | #ifdef QWS | 194 | void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) |
177 | #include <qpe/resource.h> | 195 | { |
178 | #else | 196 | if ( type != "toDS" ) return; |
179 | #include "resource.h" | 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 | |||
210 | if ( item ) // AP has been shown up, so just add our new "from" - station | ||
211 | { | ||
212 | network = static_cast<MScanListItem*>( item->parent() ); | ||
213 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | ||
214 | |||
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 | |||
221 | if ( subitem ) | ||
222 | { | ||
223 | // we have already seen this item, it's a dupe | ||
224 | #ifdef DEBUG | ||
225 | qDebug( "%s is a dupe - ignoring...", (const char*) from ); | ||
180 | #endif | 226 | #endif |
227 | subitem->receivedBeacon(); //FIXME: sent data bit | ||
228 | return; | ||
229 | } | ||
181 | 230 | ||
182 | const int col_type = 0; | 231 | // Hey, it seems to be a new item :-D |
183 | const int col_essid = 0; | 232 | MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); |
184 | const int col_sig = 1; | 233 | if ( _manufacturerdb ) |
185 | const int col_ap = 2; | 234 | station->setManufacturer( _manufacturerdb->lookup( from ) ); |
186 | const int col_channel = 3; | 235 | } |
187 | const int col_wep = 4; | 236 | else |
188 | const int col_traffic = 5; | 237 | { |
189 | const int col_manuf = 6; | 238 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); |
190 | const int col_firstseen = 7; | 239 | } |
191 | const int col_lastseen = 8; | 240 | } |
241 | |||
242 | //============================================================ | ||
243 | // MScanListItem | ||
244 | //============================================================ | ||
192 | 245 | ||
193 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 246 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
194 | bool wep, int channel, int signal ) | 247 | 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 | |||
39 | 39 | ||
40 | public slots: | 40 | public slots: |
41 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 41 | 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 ); | ||
42 | 43 | ||
43 | private: | 44 | private: |
44 | ManufacturerDB* _manufacturerdb; | 45 | 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,16 +113,10 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
113 | hexWindow()->log( p->dump( 8 ) ); | 113 | hexWindow()->log( p->dump( 8 ) ); |
114 | 114 | ||
115 | // check if we received a beacon frame | 115 | // check if we received a beacon frame |
116 | // static_cast is justified here | ||
117 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 116 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
118 | if ( !beacon ) return; | 117 | if ( beacon ) |
118 | { | ||
119 | QString type; | 119 | QString type; |
120 | |||
121 | //FIXME: Can stations in ESS mode can be distinguished from APs? | ||
122 | //FIXME: Apparently yes, but not by listening to beacons, because | ||
123 | //FIXME: they simply don't send beacons in infrastructure mode. | ||
124 | //FIXME: so we also have to listen to data packets | ||
125 | |||
126 | if ( beacon->canIBSS() ) | 120 | if ( beacon->canIBSS() ) |
127 | type = "adhoc"; | 121 | type = "adhoc"; |
128 | else | 122 | else |
@@ -135,6 +129,60 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
135 | 129 | ||
136 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 130 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
137 | netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 ); | 131 | netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 ); |
132 | return; | ||
133 | } | ||
134 | |||
135 | // check for a data frame | ||
136 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); | ||
137 | if ( data ) | ||
138 | { | ||
139 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | ||
140 | if ( wlan->fromDS() && !wlan->toDS() ) | ||
141 | { | ||
142 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | ||
143 | (const char*) wlan->macAddress3().toString(true), | ||
144 | (const char*) wlan->macAddress1().toString(true), | ||
145 | (const char*) wlan->macAddress2().toString(true) ); | ||
146 | netView()->traffic( "fromDS", wlan->macAddress3().toString(), | ||
147 | wlan->macAddress1().toString(), | ||
148 | wlan->macAddress2().toString() ); | ||
149 | } | ||
150 | else | ||
151 | if ( !wlan->fromDS() && wlan->toDS() ) | ||
152 | { | ||
153 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", | ||
154 | (const char*) wlan->macAddress2().toString(true), | ||
155 | (const char*) wlan->macAddress3().toString(true), | ||
156 | (const char*) wlan->macAddress1().toString(true) ); | ||
157 | netView()->traffic( "toDS", wlan->macAddress2().toString(), | ||
158 | wlan->macAddress3().toString(), | ||
159 | wlan->macAddress1().toString() ); | ||
160 | } | ||
161 | else | ||
162 | if ( wlan->fromDS() && wlan->toDS() ) | ||
163 | { | ||
164 | qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | ||
165 | (const char*) wlan->macAddress4().toString(true), | ||
166 | (const char*) wlan->macAddress3().toString(true), | ||
167 | (const char*) wlan->macAddress1().toString(true), | ||
168 | (const char*) wlan->macAddress2().toString(true) ); | ||
169 | netView()->traffic( "WSD", wlan->macAddress4().toString(), | ||
170 | wlan->macAddress3().toString(), | ||
171 | wlan->macAddress1().toString(), | ||
172 | wlan->macAddress2().toString() ); | ||
173 | } | ||
174 | else | ||
175 | { | ||
176 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", | ||
177 | (const char*) wlan->macAddress2().toString(true), | ||
178 | (const char*) wlan->macAddress1().toString(true), | ||
179 | (const char*) wlan->macAddress3().toString(true) ); | ||
180 | netView()->traffic( "fromDS", wlan->macAddress2().toString(), | ||
181 | wlan->macAddress1().toString(), | ||
182 | wlan->macAddress3().toString() ); | ||
183 | } | ||
184 | return; | ||
185 | } | ||
138 | } | 186 | } |
139 | 187 | ||
140 | void Wellenreiter::startStopClicked() | 188 | void Wellenreiter::startStopClicked() |