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.cpp79
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
335OMacAddress OARPPacket::senderMacAddress() const 335OMacAddress OARPPacket::senderMacAddress() const
336{ 336{
337 return OMacAddress( _arphdr->ar_sha ); 337 return OMacAddress( _arphdr->ar_sha );
338} 338}
339 339
340 340
341OMacAddress OARPPacket::targetMacAddress() const 341OMacAddress 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
352OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent ) 352OUDPPacket::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
359OUDPPacket::~OUDPPacket() 360OUDPPacket::~OUDPPacket()
360{ 361{
361} 362}
362 363
363 364
365int OUDPPacket::fromPort() const
366{
367 return _udphdr->source;
368}
369
370
371int OUDPPacket::toPort() const
372{
373 return _udphdr->dest;
374}
375
376
377int OUDPPacket::length() const
378{
379 return _udphdr->len;
380}
381
382
383int OUDPPacket::checksum() const
384{
385 return _udphdr->check;
386}
387
388
389/*======================================================================================
390 * ODHCPPacket
391 *======================================================================================*/
392
393
394ODHCPPacket::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
402ODHCPPacket::~ODHCPPacket()
403{
404}
405
406
364/*====================================================================================== 407/*======================================================================================
365 * OTCPPacket 408 * OTCPPacket
366 *======================================================================================*/ 409 *======================================================================================*/
367 410
368 411
369OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent ) 412OTCPPacket::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
376OTCPPacket::~OTCPPacket() 420OTCPPacket::~OTCPPacket()
377{ 421{
378} 422}
379 423
380 424
425int OTCPPacket::fromPort() const
426{
427 return _tcphdr->source;
428}
429
430
431int OTCPPacket::toPort() const
432{
433 return _tcphdr->dest;
434}
435
436
437int OTCPPacket::seq() const
438{
439 return _tcphdr->seq;
440}
441
442
443int OTCPPacket::ack() const
444{
445 return _tcphdr->ack_seq;
446}
447
448
449int OTCPPacket::window() const
450{
451 return _tcphdr->window;
452}
453
454
455int OTCPPacket::checksum() const
456{
457 return _tcphdr->check;
458}
459
381/*====================================================================================== 460/*======================================================================================
382 * OPrismHeaderPacket 461 * OPrismHeaderPacket
383 *======================================================================================*/ 462 *======================================================================================*/
384 463
385 464
386OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent ) 465OPrismHeaderPacket::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
397OPrismHeaderPacket::~OPrismHeaderPacket() 476OPrismHeaderPacket::~OPrismHeaderPacket()
398{ 477{
399} 478}
400 479
401 480
402unsigned int OPrismHeaderPacket::signalStrength() const 481unsigned int OPrismHeaderPacket::signalStrength() const
403{ 482{
404 return _header->signal.data; 483 return _header->signal.data;