Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 25632f3..cd74bed 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -152,28 +152,61 @@ void Wellenreiter::handleNotification( OPacket* p ) | |||
152 | } | 152 | } |
153 | else | 153 | else |
154 | { | 154 | { |
155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); |
156 | } | 156 | } |
157 | ++it; | 157 | ++it; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) | 162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
163 | { | 163 | { |
164 | if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time | 164 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); |
165 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); | ||
166 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); | ||
167 | else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); | ||
168 | } | ||
165 | 169 | ||
166 | OWaveLanManagementPacket* beacon = manage; | ||
167 | 170 | ||
171 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) | ||
172 | { | ||
173 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | ||
174 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | ||
175 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | ||
176 | int channel = ds ? ds->channel() : -1; | ||
177 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | ||
178 | |||
179 | GpsLocation loc( -111, -111 ); | ||
180 | if ( configwindow->enableGPS->isChecked() ) | ||
181 | { | ||
182 | // TODO: add check if GPS is working!? | ||
183 | qDebug( "Wellenreiter::gathering GPS data..." ); | ||
184 | loc = gps->position(); | ||
185 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | ||
186 | } | ||
187 | |||
188 | if ( essid.length() ) | ||
189 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); | ||
190 | qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); | ||
191 | } | ||
192 | |||
193 | |||
194 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) | ||
195 | { | ||
196 | } | ||
197 | |||
198 | |||
199 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | ||
200 | { | ||
168 | QString type; | 201 | QString type; |
169 | if ( beacon->canIBSS() ) | 202 | if ( beacon->canIBSS() ) |
170 | { | 203 | { |
171 | type = "adhoc"; | 204 | type = "adhoc"; |
172 | } | 205 | } |
173 | else if ( beacon->canESS() ) | 206 | else if ( beacon->canESS() ) |
174 | { | 207 | { |
175 | type = "managed"; | 208 | type = "managed"; |
176 | } | 209 | } |
177 | else | 210 | else |
178 | { | 211 | { |
179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 212 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
@@ -207,25 +240,25 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* | |||
207 | else | 240 | else |
208 | graphwindow->traffic( ds->channel(), 95 ); | 241 | graphwindow->traffic( ds->channel(), 95 ); |
209 | } | 242 | } |
210 | } | 243 | } |
211 | 244 | ||
212 | 245 | ||
213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | 246 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) |
214 | { | 247 | { |
215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 248 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
216 | 249 | ||
217 | if ( control->controlType() == "Acknowledge" ) | 250 | if ( control->controlType() == "Acknowledge" ) |
218 | { | 251 | { |
219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); | 252 | netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); |
220 | } | 253 | } |
221 | else | 254 | else |
222 | { | 255 | { |
223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | 256 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); |
224 | } | 257 | } |
225 | } | 258 | } |
226 | 259 | ||
227 | 260 | ||
228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 261 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
229 | { | 262 | { |
230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 263 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
231 | if ( wlan->fromDS() && !wlan->toDS() ) | 264 | if ( wlan->fromDS() && !wlan->toDS() ) |