-rw-r--r-- | libopie2/opienet/opcap.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 1de7124..cc8ce7f 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -335,70 +335,149 @@ QHostAddress OARPPacket::targetIPV4Address() const | |||
335 | OMacAddress OARPPacket::senderMacAddress() const | 335 | OMacAddress OARPPacket::senderMacAddress() const |
336 | { | 336 | { |
337 | return OMacAddress( _arphdr->ar_sha ); | 337 | return OMacAddress( _arphdr->ar_sha ); |
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | OMacAddress OARPPacket::targetMacAddress() const | 341 | OMacAddress OARPPacket::targetMacAddress() const |
342 | { | 342 | { |
343 | return OMacAddress( _arphdr->ar_tha ); | 343 | return OMacAddress( _arphdr->ar_tha ); |
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | /*====================================================================================== | 347 | /*====================================================================================== |
348 | * OUDPPacket | 348 | * OUDPPacket |
349 | *======================================================================================*/ | 349 | *======================================================================================*/ |
350 | 350 | ||
351 | 351 | ||
352 | OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent ) | 352 | OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent ) |
353 | :QObject( parent, "UDP" ), _udphdr( data ) | 353 | :QObject( parent, "UDP" ), _udphdr( data ) |
354 | 354 | ||
355 | { | 355 | { |
356 | qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." ); | 356 | qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." ); |
357 | } | 357 | } |
358 | 358 | ||
359 | |||
359 | OUDPPacket::~OUDPPacket() | 360 | OUDPPacket::~OUDPPacket() |
360 | { | 361 | { |
361 | } | 362 | } |
362 | 363 | ||
363 | 364 | ||
365 | int OUDPPacket::fromPort() const | ||
366 | { | ||
367 | return _udphdr->source; | ||
368 | } | ||
369 | |||
370 | |||
371 | int OUDPPacket::toPort() const | ||
372 | { | ||
373 | return _udphdr->dest; | ||
374 | } | ||
375 | |||
376 | |||
377 | int OUDPPacket::length() const | ||
378 | { | ||
379 | return _udphdr->len; | ||
380 | } | ||
381 | |||
382 | |||
383 | int OUDPPacket::checksum() const | ||
384 | { | ||
385 | return _udphdr->check; | ||
386 | } | ||
387 | |||
388 | |||
389 | /*====================================================================================== | ||
390 | * ODHCPPacket | ||
391 | *======================================================================================*/ | ||
392 | |||
393 | |||
394 | ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* data, QObject* parent ) | ||
395 | :QObject( parent, "DHCP" ), _dhcphdr( data ) | ||
396 | |||
397 | { | ||
398 | qDebug( "ODHCPPacket::ODHCPPacket(): decoding DHCP information..." ); | ||
399 | } | ||
400 | |||
401 | |||
402 | ODHCPPacket::~ODHCPPacket() | ||
403 | { | ||
404 | } | ||
405 | |||
406 | |||
364 | /*====================================================================================== | 407 | /*====================================================================================== |
365 | * OTCPPacket | 408 | * OTCPPacket |
366 | *======================================================================================*/ | 409 | *======================================================================================*/ |
367 | 410 | ||
368 | 411 | ||
369 | OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent ) | 412 | OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent ) |
370 | :QObject( parent, "TCP" ), _tcphdr( data ) | 413 | :QObject( parent, "TCP" ), _tcphdr( data ) |
371 | 414 | ||
372 | { | 415 | { |
373 | qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." ); | 416 | qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." ); |
374 | } | 417 | } |
375 | 418 | ||
419 | |||
376 | OTCPPacket::~OTCPPacket() | 420 | OTCPPacket::~OTCPPacket() |
377 | { | 421 | { |
378 | } | 422 | } |
379 | 423 | ||
380 | 424 | ||
425 | int OTCPPacket::fromPort() const | ||
426 | { | ||
427 | return _tcphdr->source; | ||
428 | } | ||
429 | |||
430 | |||
431 | int OTCPPacket::toPort() const | ||
432 | { | ||
433 | return _tcphdr->dest; | ||
434 | } | ||
435 | |||
436 | |||
437 | int OTCPPacket::seq() const | ||
438 | { | ||
439 | return _tcphdr->seq; | ||
440 | } | ||
441 | |||
442 | |||
443 | int OTCPPacket::ack() const | ||
444 | { | ||
445 | return _tcphdr->ack_seq; | ||
446 | } | ||
447 | |||
448 | |||
449 | int OTCPPacket::window() const | ||
450 | { | ||
451 | return _tcphdr->window; | ||
452 | } | ||
453 | |||
454 | |||
455 | int OTCPPacket::checksum() const | ||
456 | { | ||
457 | return _tcphdr->check; | ||
458 | } | ||
459 | |||
381 | /*====================================================================================== | 460 | /*====================================================================================== |
382 | * OPrismHeaderPacket | 461 | * OPrismHeaderPacket |
383 | *======================================================================================*/ | 462 | *======================================================================================*/ |
384 | 463 | ||
385 | 464 | ||
386 | OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent ) | 465 | OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent ) |
387 | :QObject( parent, "Prism" ), _header( data ) | 466 | :QObject( parent, "Prism" ), _header( data ) |
388 | 467 | ||
389 | { | 468 | { |
390 | qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." ); | 469 | qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." ); |
391 | 470 | ||
392 | qDebug( "Signal Strength = %d", data->signal.data ); | 471 | qDebug( "Signal Strength = %d", data->signal.data ); |
393 | 472 | ||
394 | new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this ); | 473 | new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this ); |
395 | } | 474 | } |
396 | 475 | ||
397 | OPrismHeaderPacket::~OPrismHeaderPacket() | 476 | OPrismHeaderPacket::~OPrismHeaderPacket() |
398 | { | 477 | { |
399 | } | 478 | } |
400 | 479 | ||
401 | 480 | ||
402 | unsigned int OPrismHeaderPacket::signalStrength() const | 481 | unsigned int OPrismHeaderPacket::signalStrength() const |
403 | { | 482 | { |
404 | return _header->signal.data; | 483 | return _header->signal.data; |