summaryrefslogtreecommitdiff
path: root/libopie2/opienet/opcap.cpp
Unidiff
Diffstat (limited to 'libopie2/opienet/opcap.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index cc8ce7f..f1f2b4b 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -41,6 +41,8 @@
41#include <qsocketnotifier.h> 41#include <qsocketnotifier.h>
42#include <qobjectlist.h> 42#include <qobjectlist.h>
43 43
44#include "udp_ports.h"
45
44/*====================================================================================== 46/*======================================================================================
45 * OPacket 47 * OPacket
46 *======================================================================================*/ 48 *======================================================================================*/
@@ -354,6 +356,17 @@ OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QOb
354 356
355{ 357{
356 qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." ); 358 qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." );
359 qDebug( "fromPort = %d", fromPort() );
360 qDebug( " toPort = %d", toPort() );
361
362 // TODO: Make this a case or a hash if we know more udp protocols
363
364 if ( fromPort() == UDP_PORT_BOOTPS || fromPort() == UDP_PORT_BOOTPC ||
365 toPort() == UDP_PORT_BOOTPS || toPort() == UDP_PORT_BOOTPC )
366 {
367 qDebug( "seems to be part of a DHCP conversation => creating DHCP packet." );
368 new ODHCPPacket( end, (const struct dhcp_packet*) (data+1), this );
369 }
357} 370}
358 371
359 372
@@ -364,25 +377,25 @@ OUDPPacket::~OUDPPacket()
364 377
365int OUDPPacket::fromPort() const 378int OUDPPacket::fromPort() const
366{ 379{
367 return _udphdr->source; 380 return EXTRACT_16BITS( &_udphdr->source );
368} 381}
369 382
370 383
371int OUDPPacket::toPort() const 384int OUDPPacket::toPort() const
372{ 385{
373 return _udphdr->dest; 386 return EXTRACT_16BITS( &_udphdr->dest );
374} 387}
375 388
376 389
377int OUDPPacket::length() const 390int OUDPPacket::length() const
378{ 391{
379 return _udphdr->len; 392 return EXTRACT_16BITS( &_udphdr->len );
380} 393}
381 394
382 395
383int OUDPPacket::checksum() const 396int OUDPPacket::checksum() const
384{ 397{
385 return _udphdr->check; 398 return EXTRACT_16BITS( &_udphdr->check );
386} 399}
387 400
388 401
@@ -424,37 +437,37 @@ OTCPPacket::~OTCPPacket()
424 437
425int OTCPPacket::fromPort() const 438int OTCPPacket::fromPort() const
426{ 439{
427 return _tcphdr->source; 440 return EXTRACT_16BITS( &_tcphdr->source );
428} 441}
429 442
430 443
431int OTCPPacket::toPort() const 444int OTCPPacket::toPort() const
432{ 445{
433 return _tcphdr->dest; 446 return EXTRACT_16BITS( &_tcphdr->dest );
434} 447}
435 448
436 449
437int OTCPPacket::seq() const 450int OTCPPacket::seq() const
438{ 451{
439 return _tcphdr->seq; 452 return EXTRACT_16BITS( &_tcphdr->seq );
440} 453}
441 454
442 455
443int OTCPPacket::ack() const 456int OTCPPacket::ack() const
444{ 457{
445 return _tcphdr->ack_seq; 458 return EXTRACT_16BITS( &_tcphdr->ack_seq );
446} 459}
447 460
448 461
449int OTCPPacket::window() const 462int OTCPPacket::window() const
450{ 463{
451 return _tcphdr->window; 464 return EXTRACT_16BITS( &_tcphdr->window );
452} 465}
453 466
454 467
455int OTCPPacket::checksum() const 468int OTCPPacket::checksum() const
456{ 469{
457 return _tcphdr->check; 470 return EXTRACT_16BITS( &_tcphdr->check );
458} 471}
459 472
460/*====================================================================================== 473/*======================================================================================