Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 405eda8..7394742 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -191,32 +191,53 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
191 | else | 191 | else |
192 | graphwindow->traffic( ds->channel(), 95 ); | 192 | graphwindow->traffic( ds->channel(), 95 ); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | 197 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
198 | { | 198 | { |
199 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 199 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
200 | if ( wlan->fromDS() && !wlan->toDS() ) | 200 | if ( wlan->fromDS() && !wlan->toDS() ) |
201 | { | 201 | { |
202 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 202 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
203 | from = wlan->macAddress3(); | ||
204 | to = wlan->macAddress2(); | ||
203 | } | 205 | } |
204 | else if ( !wlan->fromDS() && wlan->toDS() ) | 206 | else if ( !wlan->fromDS() && wlan->toDS() ) |
205 | { | 207 | { |
206 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 208 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
209 | from = wlan->macAddress2(); | ||
210 | to = wlan->macAddress3(); | ||
207 | } | 211 | } |
208 | else if ( wlan->fromDS() && wlan->toDS() ) | 212 | else if ( wlan->fromDS() && wlan->toDS() ) |
209 | { | 213 | { |
210 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 214 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
215 | from = wlan->macAddress4(); | ||
216 | to = wlan->macAddress3(); | ||
211 | } | 217 | } |
212 | else | 218 | else |
213 | { | 219 | { |
214 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 220 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
221 | from = wlan->macAddress2(); | ||
222 | to = wlan->macAddress1(); | ||
215 | } | 223 | } |
224 | } | ||
225 | |||
226 | |||
227 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | ||
228 | { | ||
229 | from = data->sourceAddress(); | ||
230 | to = data->destinationAddress(); | ||
231 | |||
232 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) ); | ||
233 | } | ||
234 | |||
216 | 235 | ||
236 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) | ||
237 | { | ||
217 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 238 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
218 | if ( arp ) | 239 | if ( arp ) |
219 | { | 240 | { |
220 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 241 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
221 | if ( arp->type() == "REQUEST" ) | 242 | if ( arp->type() == "REQUEST" ) |
222 | { | 243 | { |
@@ -226,16 +247,24 @@ void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | |||
226 | { | 247 | { |
227 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 248 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
228 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 249 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
229 | } | 250 | } |
230 | } | 251 | } |
231 | 252 | ||
232 | OIPPacket* ip = (OIPPacket*) p->child( "IP" ); | 253 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); |
233 | if ( ip ) | 254 | if ( dhcp ) |
255 | { | ||
256 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); | ||
257 | if ( dhcp->type() == "OFFER" ) | ||
234 | { | 258 | { |
235 | qDebug( "Received IP packet." ); | 259 | qDebug( "ADDSERVICE: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); |
260 | //netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) ); | ||
261 | |||
262 | netView()->identify( source, dhcp->serverAddress().toString() ); | ||
263 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | ||
264 | } | ||
236 | } | 265 | } |
237 | } | 266 | } |
238 | 267 | ||
239 | 268 | ||
240 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 269 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
241 | { | 270 | { |
@@ -295,22 +324,39 @@ void Wellenreiter::receivePacket( OPacket* p ) | |||
295 | if ( beacon && beacon->managementType() == "Beacon" ) | 324 | if ( beacon && beacon->managementType() == "Beacon" ) |
296 | { | 325 | { |
297 | handleBeacon( p, beacon ); | 326 | handleBeacon( p, beacon ); |
298 | return; | 327 | return; |
299 | } | 328 | } |
300 | 329 | ||
330 | OMacAddress source; | ||
331 | OMacAddress dest; | ||
332 | |||
301 | //TODO: WEP check here | 333 | //TODO: WEP check here |
302 | 334 | ||
303 | // check for a data frame | 335 | // check for a wireless data frame |
304 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); | 336 | OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); |
305 | if ( data ) | 337 | if ( wlan ) |
338 | { | ||
339 | handleWlanData( p, wlan, source, dest ); | ||
340 | } | ||
341 | |||
342 | // check for a wired data frame | ||
343 | OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); | ||
344 | if ( eth ) | ||
345 | { | ||
346 | handleEthernetData( p, eth, source, dest ); | ||
347 | } | ||
348 | |||
349 | // check for a ip frame | ||
350 | OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); | ||
351 | if ( ip ) | ||
306 | { | 352 | { |
307 | handleData( p, data ); | 353 | handleIPData( p, ip, source, dest ); |
308 | } | 354 | } |
309 | 355 | ||
310 | handleNotification( p ); | 356 | //handleNotification( p ); |
311 | 357 | ||
312 | } | 358 | } |
313 | 359 | ||
314 | 360 | ||
315 | void Wellenreiter::stopClicked() | 361 | void Wellenreiter::stopClicked() |
316 | { | 362 | { |