summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 9460f56..60bf231 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -230,13 +230,13 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd
230 to = data->destinationAddress(); 230 to = data->destinationAddress();
231 231
232 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) ); 232 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) );
233} 233}
234 234
235 235
236void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) 236void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
237{ 237{
238 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 238 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
239 if ( arp ) 239 if ( arp )
240 { 240 {
241 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); 241 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() );
242 if ( arp->type() == "REQUEST" ) 242 if ( arp->type() == "REQUEST" )
@@ -246,12 +246,18 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source,
246 else if ( arp->type() == "REPLY" ) 246 else if ( arp->type() == "REPLY" )
247 { 247 {
248 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 248 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
249 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); 249 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
250 } 250 }
251 } 251 }
252}
253
254
255void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest )
256{
257 //TODO: Implement more IP based protocols
252 258
253 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); 259 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
254 if ( dhcp ) 260 if ( dhcp )
255 { 261 {
256 qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); 262 qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() );
257 if ( dhcp->type() == "OFFER" ) 263 if ( dhcp->type() == "OFFER" )
@@ -346,12 +352,20 @@ void Wellenreiter::receivePacket( OPacket* p )
346 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); 352 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) );
347 if ( eth ) 353 if ( eth )
348 { 354 {
349 handleEthernetData( p, eth, source, dest ); 355 handleEthernetData( p, eth, source, dest );
350 } 356 }
351 357
358 // check for an arp frame since arp frames come in two flavours:
359 // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't.
360 OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) );
361 if ( arp )
362 {
363 handleARPData( p, arp, source, dest );
364 }
365
352 // check for a ip frame 366 // check for a ip frame
353 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); 367 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) );
354 if ( ip ) 368 if ( ip )
355 { 369 {
356 handleIPData( p, ip, source, dest ); 370 handleIPData( p, ip, source, dest );
357 } 371 }