summaryrefslogtreecommitdiff
path: root/libopie2/opienet
authormickeyl <mickeyl>2003-05-05 22:25:58 (UTC)
committer mickeyl <mickeyl>2003-05-05 22:25:58 (UTC)
commit3f8c29b3cbbb32864694fe9c95b43d1cb777360e (patch) (unidiff)
treedd749f9d27bfb8c9ad02bea8545fecba33555a67 /libopie2/opienet
parent3b193b852133a82b5c1708b68a7e460c63629768 (diff)
downloadopie-3f8c29b3cbbb32864694fe9c95b43d1cb777360e.zip
opie-3f8c29b3cbbb32864694fe9c95b43d1cb777360e.tar.gz
opie-3f8c29b3cbbb32864694fe9c95b43d1cb777360e.tar.bz2
fix typos
Diffstat (limited to 'libopie2/opienet') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index f6d05ea..523be3e 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -297,761 +297,761 @@ OARPPacket::OARPPacket( const unsigned char* end, const struct myarphdr* data, Q
297 qDebug( "Sender: MAC %s = IP %s", (const char*) senderMacAddress().toString(), (const char*) senderIPV4Address().toString() ); 297 qDebug( "Sender: MAC %s = IP %s", (const char*) senderMacAddress().toString(), (const char*) senderIPV4Address().toString() );
298 qDebug( "Target: MAC %s = IP %s", (const char*) targetMacAddress().toString(), (const char*) targetIPV4Address().toString() ); 298 qDebug( "Target: MAC %s = IP %s", (const char*) targetMacAddress().toString(), (const char*) targetIPV4Address().toString() );
299} 299}
300 300
301 301
302OARPPacket::~OARPPacket() 302OARPPacket::~OARPPacket()
303{ 303{
304} 304}
305 305
306 306
307QString OARPPacket::type() const 307QString OARPPacket::type() const
308{ 308{
309 switch ( EXTRACT_16BITS( &_arphdr->ar_op ) ) 309 switch ( EXTRACT_16BITS( &_arphdr->ar_op ) )
310 { 310 {
311 case 1: return "REQUEST"; 311 case 1: return "REQUEST";
312 case 2: return "REPLY"; 312 case 2: return "REPLY";
313 case 3: return "RREQUEST"; 313 case 3: return "RREQUEST";
314 case 4: return "RREPLY"; 314 case 4: return "RREPLY";
315 case 8: return "InREQUEST"; 315 case 8: return "InREQUEST";
316 case 9: return "InREPLY"; 316 case 9: return "InREPLY";
317 case 10: return "NAK"; 317 case 10: return "NAK";
318 default: qWarning( "OARPPacket::type(): invalid ARP type!" ); return "<unknown>"; 318 default: qWarning( "OARPPacket::type(): invalid ARP type!" ); return "<unknown>";
319 } 319 }
320} 320}
321 321
322 322
323QHostAddress OARPPacket::senderIPV4Address() const 323QHostAddress OARPPacket::senderIPV4Address() const
324{ 324{
325 return EXTRACT_32BITS( &_arphdr->ar_sip ); 325 return EXTRACT_32BITS( &_arphdr->ar_sip );
326} 326}
327 327
328 328
329QHostAddress OARPPacket::targetIPV4Address() const 329QHostAddress OARPPacket::targetIPV4Address() const
330{ 330{
331 return EXTRACT_32BITS( &_arphdr->ar_tip ); 331 return EXTRACT_32BITS( &_arphdr->ar_tip );
332} 332}
333 333
334 334
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
359OUDPPacket::~OUDPPacket() 359OUDPPacket::~OUDPPacket()
360{ 360{
361} 361}
362 362
363 363
364/*====================================================================================== 364/*======================================================================================
365 * OTCPPacket 365 * OTCPPacket
366 *======================================================================================*/ 366 *======================================================================================*/
367 367
368 368
369OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent ) 369OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent )
370 :QObject( parent, "TCP" ), _tcphdr( data ) 370 :QObject( parent, "TCP" ), _tcphdr( data )
371 371
372{ 372{
373 qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." ); 373 qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." );
374} 374}
375 375
376OTCPPacket::~OTCPPacket() 376OTCPPacket::~OTCPPacket()
377{ 377{
378} 378}
379 379
380 380
381/*====================================================================================== 381/*======================================================================================
382 * OPrismHeaderPacket 382 * OPrismHeaderPacket
383 *======================================================================================*/ 383 *======================================================================================*/
384 384
385 385
386OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent ) 386OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent )
387 :QObject( parent, "Prism" ), _header( data ) 387 :QObject( parent, "Prism" ), _header( data )
388 388
389{ 389{
390 qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." ); 390 qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." );
391 391
392 qDebug( "Signal Strength = %d", data->signal.data ); 392 qDebug( "Signal Strength = %d", data->signal.data );
393 393
394 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this ); 394 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this );
395} 395}
396 396
397OPrismHeaderPacket::~OPrismHeaderPacket() 397OPrismHeaderPacket::~OPrismHeaderPacket()
398{ 398{
399} 399}
400 400
401 401
402unsigned int OPrismHeaderPacket::signalStrength() const 402unsigned int OPrismHeaderPacket::signalStrength() const
403{ 403{
404 return _header->signal.data; 404 return _header->signal.data;
405} 405}
406 406
407/*====================================================================================== 407/*======================================================================================
408 * OWaveLanPacket 408 * OWaveLanPacket
409 *======================================================================================*/ 409 *======================================================================================*/
410 410
411 411
412OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent ) 412OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent )
413 :QObject( parent, "802.11" ), _wlanhdr( data ) 413 :QObject( parent, "802.11" ), _wlanhdr( data )
414 414
415{ 415{
416 qDebug( "OWaveLanPacket::OWaveLanPacket(): decoding IEEE 802.11 header..." ); 416 qDebug( "OWaveLanPacket::OWaveLanPacket(): decoding IEEE 802.11 header..." );
417 qDebug( "type: %0X", type() ); 417 qDebug( "type: %0X", type() );
418 qDebug( "subType: %0X", subType() ); 418 qDebug( "subType: %0X", subType() );
419 qDebug( "duration: %d", duration() ); 419 qDebug( "duration: %d", duration() );
420 qDebug( "powermanagement: %d", usesPowerManagement() ); 420 qDebug( "powermanagement: %d", usesPowerManagement() );
421 qDebug( "payload is encrypted: %s", usesWep() ? "yes" : "no" ); 421 qDebug( "payload is encrypted: %s", usesWep() ? "yes" : "no" );
422 qDebug( "MAC1: %s", (const char*) macAddress1().toString() ); 422 qDebug( "MAC1: %s", (const char*) macAddress1().toString() );
423 qDebug( "MAC2: %s", (const char*) macAddress2().toString() ); 423 qDebug( "MAC2: %s", (const char*) macAddress2().toString() );
424 qDebug( "MAC3: %s", (const char*) macAddress3().toString() ); 424 qDebug( "MAC3: %s", (const char*) macAddress3().toString() );
425 qDebug( "MAC4: %s", (const char*) macAddress4().toString() ); 425 qDebug( "MAC4: %s", (const char*) macAddress4().toString() );
426 426
427 switch ( type() ) 427 switch ( type() )
428 { 428 {
429 case T_MGMT: new OWaveLanManagementPacket( end, (const struct ieee_802_11_mgmt_header*) data, this ); break; 429 case T_MGMT: new OWaveLanManagementPacket( end, (const struct ieee_802_11_mgmt_header*) data, this ); break;
430 case T_DATA: new OWaveLanDataPacket( end, (const struct ieee_802_11_data_header*) data, this ); break; 430 case T_DATA: new OWaveLanDataPacket( end, (const struct ieee_802_11_data_header*) data, this ); break;
431 case T_CTRL: new OWaveLanControlPacket( end, (const struct ieee_802_11_control_header*) data, this ); break; 431 case T_CTRL: new OWaveLanControlPacket( end, (const struct ieee_802_11_control_header*) data, this ); break;
432 default: qDebug( "OWaveLanPacket::OWaveLanPacket(): Warning: Unknown major type '%d'!", type() ); 432 default: qDebug( "OWaveLanPacket::OWaveLanPacket(): Warning: Unknown major type '%d'!", type() );
433 } 433 }
434} 434}
435 435
436OWaveLanPacket::~OWaveLanPacket() 436OWaveLanPacket::~OWaveLanPacket()
437{ 437{
438} 438}
439 439
440 440
441int OWaveLanPacket::duration() const 441int OWaveLanPacket::duration() const
442{ 442{
443 return _wlanhdr->duration; 443 return _wlanhdr->duration;
444} 444}
445 445
446 446
447OMacAddress OWaveLanPacket::macAddress1() const 447OMacAddress OWaveLanPacket::macAddress1() const
448{ 448{
449 return OMacAddress( _wlanhdr->mac1 ); 449 return OMacAddress( _wlanhdr->mac1 );
450} 450}
451 451
452 452
453OMacAddress OWaveLanPacket::macAddress2() const 453OMacAddress OWaveLanPacket::macAddress2() const
454{ 454{
455 return OMacAddress( _wlanhdr->mac2 ); 455 return OMacAddress( _wlanhdr->mac2 );
456} 456}
457 457
458 458
459OMacAddress OWaveLanPacket::macAddress3() const 459OMacAddress OWaveLanPacket::macAddress3() const
460{ 460{
461 return OMacAddress( _wlanhdr->mac3 ); 461 return OMacAddress( _wlanhdr->mac3 );
462} 462}
463 463
464 464
465OMacAddress OWaveLanPacket::macAddress4() const 465OMacAddress OWaveLanPacket::macAddress4() const
466{ 466{
467 return OMacAddress( _wlanhdr->mac4 ); 467 return OMacAddress( _wlanhdr->mac4 );
468} 468}
469 469
470 470
471int OWaveLanPacket::subType() const 471int OWaveLanPacket::subType() const
472{ 472{
473 return FC_SUBTYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 473 return FC_SUBTYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
474} 474}
475 475
476 476
477int OWaveLanPacket::type() const 477int OWaveLanPacket::type() const
478{ 478{
479 return FC_TYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 479 return FC_TYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
480} 480}
481 481
482 482
483int OWaveLanPacket::version() const 483int OWaveLanPacket::version() const
484{ 484{
485 return FC_VERSION( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 485 return FC_VERSION( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
486} 486}
487 487
488 488
489bool OWaveLanPacket::fromDS() const 489bool OWaveLanPacket::fromDS() const
490{ 490{
491 return FC_FROM_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 491 return FC_FROM_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
492} 492}
493 493
494 494
495bool OWaveLanPacket::toDS() const 495bool OWaveLanPacket::toDS() const
496{ 496{
497 return FC_TO_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 497 return FC_TO_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
498} 498}
499 499
500 500
501bool OWaveLanPacket::usesPowerManagement() const 501bool OWaveLanPacket::usesPowerManagement() const
502{ 502{
503 return FC_POWER_MGMT( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 503 return FC_POWER_MGMT( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
504} 504}
505 505
506 506
507bool OWaveLanPacket::usesWep() const 507bool OWaveLanPacket::usesWep() const
508{ 508{
509 return FC_WEP( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 509 return FC_WEP( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
510} 510}
511 511
512 512
513/*====================================================================================== 513/*======================================================================================
514 * OWaveLanManagementPacket 514 * OWaveLanManagementPacket
515 *======================================================================================*/ 515 *======================================================================================*/
516 516
517OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, const struct ieee_802_11_mgmt_header* data, OWaveLanPacket* parent ) 517OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, const struct ieee_802_11_mgmt_header* data, OWaveLanPacket* parent )
518 :QObject( parent, "802.11 Management" ), _header( data ), 518 :QObject( parent, "802.11 Management" ), _header( data ),
519 _body( (const struct ieee_802_11_mgmt_body*) (data+1) ) 519 _body( (const struct ieee_802_11_mgmt_body*) (data+1) )
520{ 520{
521 qDebug( "OWaveLanManagementPacket::OWaveLanManagementPacket(): decoding frame..." ); 521 qDebug( "OWaveLanManagementPacket::OWaveLanManagementPacket(): decoding frame..." );
522 qDebug( "Detected subtype is '%s'", (const char*) managementType() ); 522 qDebug( "Detected subtype is '%s'", (const char*) managementType() );
523 523
524 // grab tagged values 524 // grab tagged values
525 const unsigned char* ptr = (const unsigned char*) (_body+1); 525 const unsigned char* ptr = (const unsigned char*) (_body+1);
526 while (ptr < end) 526 while (ptr < end)
527 { 527 {
528 switch ( *ptr ) 528 switch ( *ptr )
529 { 529 {
530 case E_SSID: new OWaveLanManagementSSID( end, (struct ssid_t*) ptr, this ); break; 530 case E_SSID: new OWaveLanManagementSSID( end, (struct ssid_t*) ptr, this ); break;
531 case E_FH: new OWaveLanManagementFH( end, (struct fh_t*) ptr, this ); break; 531 case E_FH: new OWaveLanManagementFH( end, (struct fh_t*) ptr, this ); break;
532 case E_DS: new OWaveLanManagementDS( end, (struct ds_t*) ptr, this ); break; 532 case E_DS: new OWaveLanManagementDS( end, (struct ds_t*) ptr, this ); break;
533 case E_RATES: new OWaveLanManagementRates( end, (struct rates_t*) ptr, this ); break; 533 case E_RATES: new OWaveLanManagementRates( end, (struct rates_t*) ptr, this ); break;
534 case E_CF: new OWaveLanManagementCF( end, (struct cf_t*) ptr, this ); break; 534 case E_CF: new OWaveLanManagementCF( end, (struct cf_t*) ptr, this ); break;
535 case E_TIM: new OWaveLanManagementTim( end, (struct tim_t*) ptr, this ); break; 535 case E_TIM: new OWaveLanManagementTim( end, (struct tim_t*) ptr, this ); break;
536 case E_IBSS: new OWaveLanManagementIBSS( end, (struct ibss_t*) ptr, this ); break; 536 case E_IBSS: new OWaveLanManagementIBSS( end, (struct ibss_t*) ptr, this ); break;
537 case E_CHALLENGE: new OWaveLanManagementChallenge( end, (struct challenge_t*) ptr, this ); break; 537 case E_CHALLENGE: new OWaveLanManagementChallenge( end, (struct challenge_t*) ptr, this ); break;
538 } 538 }
539 ptr+= ( ( struct ssid_t* ) ptr )->length; // skip length of tagged value 539 ptr+= ( ( struct ssid_t* ) ptr )->length; // skip length of tagged value
540 ptr+= 2; // skip tag ID and length 540 ptr+= 2; // skip tag ID and length
541 } 541 }
542} 542}
543 543
544 544
545OWaveLanManagementPacket::~OWaveLanManagementPacket() 545OWaveLanManagementPacket::~OWaveLanManagementPacket()
546{ 546{
547} 547}
548 548
549 549
550QString OWaveLanManagementPacket::managementType() const 550QString OWaveLanManagementPacket::managementType() const
551{ 551{
552 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) ) 552 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) )
553 { 553 {
554 case ST_ASSOC_REQUEST: return "AssociationRequest"; break; 554 case ST_ASSOC_REQUEST: return "AssociationRequest"; break;
555 case ST_ASSOC_RESPONSE: return "AssociationResponse"; break; 555 case ST_ASSOC_RESPONSE: return "AssociationResponse"; break;
556 case ST_REASSOC_REQUEST: return "ReassociationRequest"; break; 556 case ST_REASSOC_REQUEST: return "ReassociationRequest"; break;
557 case ST_REASSOC_RESPONSE: return "ReassociationResponse"; break; 557 case ST_REASSOC_RESPONSE: return "ReassociationResponse"; break;
558 case ST_PROBE_REQUEST: return "ProbeRequest"; break; 558 case ST_PROBE_REQUEST: return "ProbeRequest"; break;
559 case ST_PROBE_RESPONSE: return "ProbeResponse"; break; 559 case ST_PROBE_RESPONSE: return "ProbeResponse"; break;
560 case ST_BEACON: return "Beacon"; break; 560 case ST_BEACON: return "Beacon"; break;
561 case ST_ATIM: return "Atim"; break; 561 case ST_ATIM: return "Atim"; break;
562 case ST_DISASSOC: return "Disassociation"; break; 562 case ST_DISASSOC: return "Disassociation"; break;
563 case ST_AUTH: return "Authentication"; break; 563 case ST_AUTH: return "Authentication"; break;
564 case ST_DEAUTH: return "Deathentication"; break; 564 case ST_DEAUTH: return "Deathentication"; break;
565 default: 565 default:
566 qWarning( "OWaveLanManagementPacket::managementType(): unhandled subtype %d", FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) ); 566 qWarning( "OWaveLanManagementPacket::managementType(): unhandled subtype %d", FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) );
567 return "Unknown"; 567 return "Unknown";
568 } 568 }
569} 569}
570 570
571 571
572int OWaveLanManagementPacket::beaconInterval() const 572int OWaveLanManagementPacket::beaconInterval() const
573{ 573{
574 return EXTRACT_LE_16BITS( &_body->beacon_interval ); 574 return EXTRACT_LE_16BITS( &_body->beacon_interval );
575} 575}
576 576
577 577
578int OWaveLanManagementPacket::capabilities() const 578int OWaveLanManagementPacket::capabilities() const
579{ 579{
580 return EXTRACT_LE_16BITS( &_body->capability_info ); 580 return EXTRACT_LE_16BITS( &_body->capability_info );
581} 581}
582 582
583 583
584bool OWaveLanManagementPacket::canESS() const 584bool OWaveLanManagementPacket::canESS() const
585{ 585{
586 return CAPABILITY_ESS( EXTRACT_LE_16BITS( &_body->capability_info ) ); 586 return CAPABILITY_ESS( EXTRACT_LE_16BITS( &_body->capability_info ) );
587} 587}
588 588
589 589
590bool OWaveLanManagementPacket::canIBSS() const 590bool OWaveLanManagementPacket::canIBSS() const
591{ 591{
592 return CAPABILITY_IBSS( EXTRACT_LE_16BITS( &_body->capability_info ) ); 592 return CAPABILITY_IBSS( EXTRACT_LE_16BITS( &_body->capability_info ) );
593} 593}
594 594
595 595
596bool OWaveLanManagementPacket::canCFP() const 596bool OWaveLanManagementPacket::canCFP() const
597{ 597{
598 return CAPABILITY_CFP( EXTRACT_LE_16BITS( &_body->capability_info ) ); 598 return CAPABILITY_CFP( EXTRACT_LE_16BITS( &_body->capability_info ) );
599} 599}
600 600
601 601
602bool OWaveLanManagementPacket::canCFP_REQ() const 602bool OWaveLanManagementPacket::canCFP_REQ() const
603{ 603{
604 return CAPABILITY_CFP_REQ( EXTRACT_LE_16BITS( &_body->capability_info ) ); 604 return CAPABILITY_CFP_REQ( EXTRACT_LE_16BITS( &_body->capability_info ) );
605} 605}
606 606
607 607
608bool OWaveLanManagementPacket::canPrivacy() const 608bool OWaveLanManagementPacket::canPrivacy() const
609{ 609{
610 return CAPABILITY_PRIVACY( EXTRACT_LE_16BITS( &_body->capability_info ) ); 610 return CAPABILITY_PRIVACY( EXTRACT_LE_16BITS( &_body->capability_info ) );
611} 611}
612 612
613 613
614/*====================================================================================== 614/*======================================================================================
615 * OWaveLanManagementSSID 615 * OWaveLanManagementSSID
616 *======================================================================================*/ 616 *======================================================================================*/
617 617
618OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const struct ssid_t* data, QObject* parent ) 618OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const struct ssid_t* data, QObject* parent )
619 :QObject( parent, "802.11 SSID" ), _data( data ) 619 :QObject( parent, "802.11 SSID" ), _data( data )
620{ 620{
621 qDebug( "OWaveLanManagementSSID()" ); 621 qDebug( "OWaveLanManagementSSID()" );
622} 622}
623 623
624 624
625OWaveLanManagementSSID::~OWaveLanManagementSSID() 625OWaveLanManagementSSID::~OWaveLanManagementSSID()
626{ 626{
627} 627}
628 628
629 629
630QString OWaveLanManagementSSID::ID() const 630QString OWaveLanManagementSSID::ID() const
631{ 631{
632 int length = _data->length; 632 int length = _data->length;
633 if ( length > 32 ) length = 32; 633 if ( length > 32 ) length = 32;
634 char essid[length+1]; 634 char essid[length+1];
635 memcpy( &essid, &_data->ssid, length ); 635 memcpy( &essid, &_data->ssid, length );
636 essid[length] = 0x0; 636 essid[length] = 0x0;
637 return essid; 637 return essid;
638} 638}
639 639
640 640
641/*====================================================================================== 641/*======================================================================================
642 * OWaveLanManagementRates 642 * OWaveLanManagementRates
643 *======================================================================================*/ 643 *======================================================================================*/
644 644
645OWaveLanManagementRates::OWaveLanManagementRates( const unsigned char* end, const struct rates_t* data, QObject* parent ) 645OWaveLanManagementRates::OWaveLanManagementRates( const unsigned char* end, const struct rates_t* data, QObject* parent )
646 :QObject( parent, "802.11 Rates" ), _data( data ) 646 :QObject( parent, "802.11 Rates" ), _data( data )
647{ 647{
648 qDebug( "OWaveLanManagementRates()" ); 648 qDebug( "OWaveLanManagementRates()" );
649} 649}
650 650
651 651
652OWaveLanManagementRates::~OWaveLanManagementRates() 652OWaveLanManagementRates::~OWaveLanManagementRates()
653{ 653{
654} 654}
655 655
656/*====================================================================================== 656/*======================================================================================
657 * OWaveLanManagementCF 657 * OWaveLanManagementCF
658 *======================================================================================*/ 658 *======================================================================================*/
659 659
660OWaveLanManagementCF::OWaveLanManagementCF( const unsigned char* end, const struct cf_t* data, QObject* parent ) 660OWaveLanManagementCF::OWaveLanManagementCF( const unsigned char* end, const struct cf_t* data, QObject* parent )
661 :QObject( parent, "802.11 CF" ), _data( data ) 661 :QObject( parent, "802.11 CF" ), _data( data )
662{ 662{
663 qDebug( "OWaveLanManagementCF()" ); 663 qDebug( "OWaveLanManagementCF()" );
664} 664}
665 665
666 666
667OWaveLanManagementCF::~OWaveLanManagementCF() 667OWaveLanManagementCF::~OWaveLanManagementCF()
668{ 668{
669} 669}
670 670
671/*====================================================================================== 671/*======================================================================================
672 * OWaveLanManagementFH 672 * OWaveLanManagementFH
673 *======================================================================================*/ 673 *======================================================================================*/
674 674
675OWaveLanManagementFH::OWaveLanManagementFH( const unsigned char* end, const struct fh_t* data, QObject* parent ) 675OWaveLanManagementFH::OWaveLanManagementFH( const unsigned char* end, const struct fh_t* data, QObject* parent )
676 :QObject( parent, "802.11 FH" ), _data( data ) 676 :QObject( parent, "802.11 FH" ), _data( data )
677{ 677{
678 qDebug( "OWaveLanManagementFH()" ); 678 qDebug( "OWaveLanManagementFH()" );
679} 679}
680 680
681 681
682OWaveLanManagementFH::~OWaveLanManagementFH() 682OWaveLanManagementFH::~OWaveLanManagementFH()
683{ 683{
684} 684}
685 685
686/*====================================================================================== 686/*======================================================================================
687 * OWaveLanManagementDS 687 * OWaveLanManagementDS
688 *======================================================================================*/ 688 *======================================================================================*/
689 689
690OWaveLanManagementDS::OWaveLanManagementDS( const unsigned char* end, const struct ds_t* data, QObject* parent ) 690OWaveLanManagementDS::OWaveLanManagementDS( const unsigned char* end, const struct ds_t* data, QObject* parent )
691 :QObject( parent, "802.11 DS" ), _data( data ) 691 :QObject( parent, "802.11 DS" ), _data( data )
692{ 692{
693 qDebug( "OWaveLanManagementDS()" ); 693 qDebug( "OWaveLanManagementDS()" );
694} 694}
695 695
696 696
697OWaveLanManagementDS::~OWaveLanManagementDS() 697OWaveLanManagementDS::~OWaveLanManagementDS()
698{ 698{
699} 699}
700 700
701 701
702int OWaveLanManagementDS::channel() const 702int OWaveLanManagementDS::channel() const
703{ 703{
704 return _data->channel; 704 return _data->channel;
705} 705}
706 706
707/*====================================================================================== 707/*======================================================================================
708 * OWaveLanManagementTim 708 * OWaveLanManagementTim
709 *======================================================================================*/ 709 *======================================================================================*/
710 710
711OWaveLanManagementTim::OWaveLanManagementTim( const unsigned char* end, const struct tim_t* data, QObject* parent ) 711OWaveLanManagementTim::OWaveLanManagementTim( const unsigned char* end, const struct tim_t* data, QObject* parent )
712 :QObject( parent, "802.11 Tim" ), _data( data ) 712 :QObject( parent, "802.11 Tim" ), _data( data )
713{ 713{
714 qDebug( "OWaveLanManagementTim()" ); 714 qDebug( "OWaveLanManagementTim()" );
715} 715}
716 716
717 717
718OWaveLanManagementTim::~OWaveLanManagementTim() 718OWaveLanManagementTim::~OWaveLanManagementTim()
719{ 719{
720} 720}
721 721
722/*====================================================================================== 722/*======================================================================================
723 * OWaveLanManagementIBSS 723 * OWaveLanManagementIBSS
724 *======================================================================================*/ 724 *======================================================================================*/
725 725
726OWaveLanManagementIBSS::OWaveLanManagementIBSS( const unsigned char* end, const struct ibss_t* data, QObject* parent ) 726OWaveLanManagementIBSS::OWaveLanManagementIBSS( const unsigned char* end, const struct ibss_t* data, QObject* parent )
727 :QObject( parent, "802.11 IBSS" ), _data( data ) 727 :QObject( parent, "802.11 IBSS" ), _data( data )
728{ 728{
729 qDebug( "OWaveLanManagementIBSS()" ); 729 qDebug( "OWaveLanManagementIBSS()" );
730} 730}
731 731
732 732
733OWaveLanManagementIBSS::~OWaveLanManagementIBSS() 733OWaveLanManagementIBSS::~OWaveLanManagementIBSS()
734{ 734{
735} 735}
736 736
737/*====================================================================================== 737/*======================================================================================
738 * OWaveLanManagementChallenge 738 * OWaveLanManagementChallenge
739 *======================================================================================*/ 739 *======================================================================================*/
740 740
741OWaveLanManagementChallenge::OWaveLanManagementChallenge( const unsigned char* end, const struct challenge_t* data, QObject* parent ) 741OWaveLanManagementChallenge::OWaveLanManagementChallenge( const unsigned char* end, const struct challenge_t* data, QObject* parent )
742 :QObject( parent, "802.11 Challenge" ), _data( data ) 742 :QObject( parent, "802.11 Challenge" ), _data( data )
743{ 743{
744 qDebug( "OWaveLanManagementChallenge()" ); 744 qDebug( "OWaveLanManagementChallenge()" );
745} 745}
746 746
747 747
748OWaveLanManagementChallenge::~OWaveLanManagementChallenge() 748OWaveLanManagementChallenge::~OWaveLanManagementChallenge()
749{ 749{
750} 750}
751 751
752/*====================================================================================== 752/*======================================================================================
753 * OWaveLanDataPacket 753 * OWaveLanDataPacket
754 *======================================================================================*/ 754 *======================================================================================*/
755 755
756OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent ) 756OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent )
757 :QObject( parent, "802.11 Data" ), _header( data ) 757 :QObject( parent, "802.11 Data" ), _header( data )
758{ 758{
759 qDebug( "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." ); 759 qDebug( "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." );
760 760
761 const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header ); 761 const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header );
762 762
763 #warning The next line works for most cases, but can not be correct generally! 763 #warning The next line works for most cases, but can not be correct generally!
764 if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address 764 if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address
765 765
766 new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this ); 766 new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this );
767} 767}
768 768
769 769
770OWaveLanDataPacket::~OWaveLanDataPacket() 770OWaveLanDataPacket::~OWaveLanDataPacket()
771{ 771{
772} 772}
773 773
774 774
775/*====================================================================================== 775/*======================================================================================
776 * OLLCPacket 776 * OLLCPacket
777 *======================================================================================*/ 777 *======================================================================================*/
778 778
779OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent ) 779OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent )
780 :QObject( parent, "802.11 LLC" ), _header( data ) 780 :QObject( parent, "802.11 LLC" ), _header( data )
781{ 781{
782 qDebug( "OLLCPacket::OLLCPacket(): decoding frame..." ); 782 qDebug( "OLLCPacket::OLLCPacket(): decoding frame..." );
783 783
784 if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) ) 784 if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) )
785 { 785 {
786 qDebug( "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type=%04X)", EXTRACT_16BITS( &_header->type ) ); 786 qDebug( "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type=%04X)", EXTRACT_16BITS( &_header->type ) );
787 787
788 switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h 788 switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h
789 { 789 {
790 case ETH_P_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break; 790 case ETH_P_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break;
791 case ETH_P_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break; 791 case ETH_P_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break;
792 default: qWarning( "OLLCPacket::OLLCPacket(): Unknown Encapsulation (type=%04X)", EXTRACT_16BITS( &_header->type ) ); 792 default: qWarning( "OLLCPacket::OLLCPacket(): Unknown Encapsulation (type=%04X)", EXTRACT_16BITS( &_header->type ) );
793 } 793 }
794 794
795 } 795 }
796} 796}
797 797
798 798
799OLLCPacket::~OLLCPacket() 799OLLCPacket::~OLLCPacket()
800{ 800{
801} 801}
802 802
803 803
804/*====================================================================================== 804/*======================================================================================
805 * OWaveLanControlPacket 805 * OWaveLanControlPacket
806 *======================================================================================*/ 806 *======================================================================================*/
807 807
808OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const struct ieee_802_11_control_header* data, OWaveLanPacket* parent ) 808OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const struct ieee_802_11_control_header* data, OWaveLanPacket* parent )
809 :QObject( parent, "802.11 Data" ), _header( data ) 809 :QObject( parent, "802.11 Control" ), _header( data )
810{ 810{
811 qDebug( "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." ); 811 qDebug( "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." );
812 //TODO: Implement this 812 //TODO: Implement this
813} 813}
814 814
815 815
816OWaveLanControlPacket::~OWaveLanControlPacket() 816OWaveLanControlPacket::~OWaveLanControlPacket()
817{ 817{
818} 818}
819 819
820 820
821/*====================================================================================== 821/*======================================================================================
822 * OPacketCapturer 822 * OPacketCapturer
823 *======================================================================================*/ 823 *======================================================================================*/
824 824
825OPacketCapturer::OPacketCapturer( QObject* parent, const char* name ) 825OPacketCapturer::OPacketCapturer( QObject* parent, const char* name )
826 :QObject( parent, name ), _name( QString::null ), _open( false ), 826 :QObject( parent, name ), _name( QString::null ), _open( false ),
827 _pch( 0 ), _pcd( 0 ), _sn( 0 ) 827 _pch( 0 ), _pcd( 0 ), _sn( 0 )
828{ 828{
829} 829}
830 830
831 831
832OPacketCapturer::~OPacketCapturer() 832OPacketCapturer::~OPacketCapturer()
833{ 833{
834 if ( _open ) 834 if ( _open )
835 { 835 {
836 qDebug( "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." ); 836 qDebug( "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." );
837 close(); 837 close();
838 } 838 }
839} 839}
840 840
841 841
842void OPacketCapturer::setBlocking( bool b ) 842void OPacketCapturer::setBlocking( bool b )
843{ 843{
844 if ( pcap_setnonblock( _pch, 1-b, _errbuf ) != -1 ) 844 if ( pcap_setnonblock( _pch, 1-b, _errbuf ) != -1 )
845 { 845 {
846 qDebug( "OPacketCapturer::setBlocking(): blocking mode changed successfully." ); 846 qDebug( "OPacketCapturer::setBlocking(): blocking mode changed successfully." );
847 } 847 }
848 else 848 else
849 { 849 {
850 qDebug( "OPacketCapturer::setBlocking(): can't change blocking mode: %s", _errbuf ); 850 qDebug( "OPacketCapturer::setBlocking(): can't change blocking mode: %s", _errbuf );
851 } 851 }
852} 852}
853 853
854 854
855bool OPacketCapturer::blocking() const 855bool OPacketCapturer::blocking() const
856{ 856{
857 int b = pcap_getnonblock( _pch, _errbuf ); 857 int b = pcap_getnonblock( _pch, _errbuf );
858 if ( b == -1 ) 858 if ( b == -1 )
859 { 859 {
860 qDebug( "OPacketCapturer::blocking(): can't get blocking mode: %s", _errbuf ); 860 qDebug( "OPacketCapturer::blocking(): can't get blocking mode: %s", _errbuf );
861 return -1; 861 return -1;
862 } 862 }
863 return !b; 863 return !b;
864} 864}
865 865
866 866
867void OPacketCapturer::close() 867void OPacketCapturer::close()
868{ 868{
869 if ( _open ) 869 if ( _open )
870 { 870 {
871 if ( _sn ) 871 if ( _sn )
872 { 872 {
873 _sn->disconnect( SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) ); 873 _sn->disconnect( SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) );
874 delete _sn; 874 delete _sn;
875 } 875 }
876 if ( _pcd ) 876 if ( _pcd )
877 { 877 {
878 pcap_dump_close( _pcd ); 878 pcap_dump_close( _pcd );
879 _pcd = 0; 879 _pcd = 0;
880 } 880 }
881 pcap_close( _pch ); 881 pcap_close( _pch );
882 _open = false; 882 _open = false;
883 } 883 }
884 884
885 qDebug( "OPacketCapturer::close() --- dumping capturing statistics..." ); 885 qDebug( "OPacketCapturer::close() --- dumping capturing statistics..." );
886 qDebug( "--------------------------------------------------" ); 886 qDebug( "--------------------------------------------------" );
887 for( QMap<QString,int>::Iterator it = _stats.begin(); it != _stats.end(); ++it ) 887 for( QMap<QString,int>::Iterator it = _stats.begin(); it != _stats.end(); ++it )
888 qDebug( "%s : %d", (const char*) it.key(), it.data() ); 888 qDebug( "%s : %d", (const char*) it.key(), it.data() );
889 qDebug( "--------------------------------------------------" ); 889 qDebug( "--------------------------------------------------" );
890 890
891} 891}
892 892
893 893
894int OPacketCapturer::dataLink() const 894int OPacketCapturer::dataLink() const
895{ 895{
896 return pcap_datalink( _pch ); 896 return pcap_datalink( _pch );
897} 897}
898 898
899 899
900int OPacketCapturer::fileno() const 900int OPacketCapturer::fileno() const
901{ 901{
902 if ( _open ) 902 if ( _open )
903 { 903 {
904 return pcap_fileno( _pch ); 904 return pcap_fileno( _pch );
905 } 905 }
906 else 906 else
907 { 907 {
908 return -1; 908 return -1;
909 } 909 }
910} 910}
911 911
912OPacket* OPacketCapturer::next() 912OPacket* OPacketCapturer::next()
913{ 913{
914 packetheaderstruct header; 914 packetheaderstruct header;
915 qDebug( "==> OPacketCapturer::next()" ); 915 qDebug( "==> OPacketCapturer::next()" );
916 const unsigned char* pdata = pcap_next( _pch, &header ); 916 const unsigned char* pdata = pcap_next( _pch, &header );
917 qDebug( "<== OPacketCapturer::next()" ); 917 qDebug( "<== OPacketCapturer::next()" );
918 if ( _pcd ) 918 if ( _pcd )
919 pcap_dump( (u_char*) _pcd, &header, pdata ); 919 pcap_dump( (u_char*) _pcd, &header, pdata );
920 920
921 if ( pdata && header.len ) 921 if ( pdata && header.len )
922 { 922 {
923 OPacket* p = new OPacket( dataLink(), header, pdata, 0 ); 923 OPacket* p = new OPacket( dataLink(), header, pdata, 0 );
924 // packets shouldn't be inserted in the QObject child-parent hierarchy, 924 // packets shouldn't be inserted in the QObject child-parent hierarchy,
925 // because due to memory constraints they will be deleted as soon 925 // because due to memory constraints they will be deleted as soon
926 // as possible - that is right after they have been processed 926 // as possible - that is right after they have been processed
927 // by emit() [ see below ] 927 // by emit() [ see below ]
928 //TODO: make gathering statistics optional, because it takes time 928 //TODO: make gathering statistics optional, because it takes time
929 p->updateStats( _stats, const_cast<QObjectList*>( p->children() ) ); 929 p->updateStats( _stats, const_cast<QObjectList*>( p->children() ) );
930 930
931 return p; 931 return p;
932 } 932 }
933 else 933 else
934 { 934 {
935 qWarning( "OPacketCapturer::next() - no packet received!" ); 935 qWarning( "OPacketCapturer::next() - no packet received!" );
936 return 0; 936 return 0;
937 } 937 }
938} 938}
939 939
940 940
941bool OPacketCapturer::open( const QString& name, const QString& filename ) 941bool OPacketCapturer::open( const QString& name, const QString& filename )
942{ 942{
943 if ( _open ) 943 if ( _open )
944 { 944 {
945 if ( name == _name ) // ignore opening an already openend device 945 if ( name == _name ) // ignore opening an already openend device
946 { 946 {
947 return true; 947 return true;
948 } 948 }
949 else // close the last opened device 949 else // close the last opened device
950 { 950 {
951 close(); 951 close();
952 } 952 }
953 } 953 }
954 954
955 _name = name; 955 _name = name;
956 956
957 // open libpcap 957 // open libpcap
958 pcap_t* handle = pcap_open_live( const_cast<char*>( (const char*) name ), 1024, 0, 0, &_errbuf[0] ); 958 pcap_t* handle = pcap_open_live( const_cast<char*>( (const char*) name ), 1024, 0, 0, &_errbuf[0] );
959 959
960 if ( !handle ) 960 if ( !handle )
961 { 961 {
962 qWarning( "OPacketCapturer::open(): can't open libpcap with '%s': %s", (const char*) name, _errbuf ); 962 qWarning( "OPacketCapturer::open(): can't open libpcap with '%s': %s", (const char*) name, _errbuf );
963 return false; 963 return false;
964 } 964 }
965 965
966 qDebug( "OPacketCapturer::open(): libpcap [%s] opened successfully.", (const char*) name ); 966 qDebug( "OPacketCapturer::open(): libpcap [%s] opened successfully.", (const char*) name );
967 _pch = handle; 967 _pch = handle;
968 _open = true; 968 _open = true;
969 _stats.clear(); 969 _stats.clear();
970 970
971 // in case we have an application object, create a socket notifier 971 // in case we have an application object, create a socket notifier
972 if ( qApp ) //TODO: I don't like this here... 972 if ( qApp ) //TODO: I don't like this here...
973 { 973 {
974 _sn = new QSocketNotifier( fileno(), QSocketNotifier::Read ); 974 _sn = new QSocketNotifier( fileno(), QSocketNotifier::Read );
975 connect( _sn, SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) ); 975 connect( _sn, SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) );
976 } 976 }
977 977
978 // if requested, open a dump 978 // if requested, open a dump
979 pcap_dumper_t* dump = pcap_dump_open( _pch, const_cast<char*>( (const char*) filename ) ); 979 pcap_dumper_t* dump = pcap_dump_open( _pch, const_cast<char*>( (const char*) filename ) );
980 if ( !dump ) 980 if ( !dump )
981 { 981 {
982 qWarning( "OPacketCapturer::open(): can't open dump with '%s': %s", (const char*) filename, _errbuf ); 982 qWarning( "OPacketCapturer::open(): can't open dump with '%s': %s", (const char*) filename, _errbuf );
983 return false; 983 return false;
984 } 984 }
985 qDebug( "OPacketCapturer::open(): dump [%s] opened successfully.", (const char*) filename ); 985 qDebug( "OPacketCapturer::open(): dump [%s] opened successfully.", (const char*) filename );
986 _pcd = dump; 986 _pcd = dump;
987 987
988 return true; 988 return true;
989} 989}
990 990
991 991
992bool OPacketCapturer::open( const QFile& file ) 992bool OPacketCapturer::open( const QFile& file )
993{ 993{
994 QString name = file.name(); 994 QString name = file.name();
995 995
996 if ( _open ) 996 if ( _open )
997 { 997 {
998 close(); 998 close();
999 if ( name == _name ) // ignore opening an already openend device 999 if ( name == _name ) // ignore opening an already openend device
1000 { 1000 {
1001 return true; 1001 return true;
1002 } 1002 }
1003 else // close the last opened device 1003 else // close the last opened device
1004 { 1004 {
1005 close(); 1005 close();
1006 } 1006 }
1007 } 1007 }
1008 1008
1009 _name = name; 1009 _name = name;
1010 1010
1011 pcap_t* handle = pcap_open_offline( const_cast<char*>( (const char*) name ), &_errbuf[0] ); 1011 pcap_t* handle = pcap_open_offline( const_cast<char*>( (const char*) name ), &_errbuf[0] );
1012 1012
1013 if ( handle ) 1013 if ( handle )
1014 { 1014 {
1015 qDebug( "OPacketCapturer::open(): libpcap opened successfully." ); 1015 qDebug( "OPacketCapturer::open(): libpcap opened successfully." );
1016 _pch = handle; 1016 _pch = handle;
1017 _open = true; 1017 _open = true;
1018 1018
1019 // in case we have an application object, create a socket notifier 1019 // in case we have an application object, create a socket notifier
1020 if ( qApp ) 1020 if ( qApp )
1021 { 1021 {
1022 _sn = new QSocketNotifier( fileno(), QSocketNotifier::Read ); 1022 _sn = new QSocketNotifier( fileno(), QSocketNotifier::Read );
1023 connect( _sn, SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) ); 1023 connect( _sn, SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) );
1024 } 1024 }
1025 1025
1026 return true; 1026 return true;
1027 } 1027 }
1028 else 1028 else
1029 { 1029 {
1030 qDebug( "OPacketCapturer::open(): can't open libpcap with '%s': %s", (const char*) name, _errbuf ); 1030 qDebug( "OPacketCapturer::open(): can't open libpcap with '%s': %s", (const char*) name, _errbuf );
1031 return false; 1031 return false;
1032 } 1032 }
1033 1033
1034} 1034}
1035 1035
1036 1036
1037bool OPacketCapturer::isOpen() const 1037bool OPacketCapturer::isOpen() const
1038{ 1038{
1039 return _open; 1039 return _open;
1040} 1040}
1041 1041
1042 1042
1043void OPacketCapturer::readyToReceive() 1043void OPacketCapturer::readyToReceive()
1044{ 1044{
1045 qDebug( "OPacketCapturer::readyToReceive(): about to emit 'receivePacket(p)'" ); 1045 qDebug( "OPacketCapturer::readyToReceive(): about to emit 'receivePacket(p)'" );
1046 OPacket* p = next(); 1046 OPacket* p = next();
1047 emit receivedPacket( p ); 1047 emit receivedPacket( p );
1048 // emit is synchronous - packet has been dealt with, now it's safe to delete 1048 // emit is synchronous - packet has been dealt with, now it's safe to delete
1049 delete p; 1049 delete p;
1050} 1050}
1051 1051
1052 1052
1053const QMap<QString,int>& OPacketCapturer::statistics() const 1053const QMap<QString,int>& OPacketCapturer::statistics() const
1054{ 1054{
1055 return _stats; 1055 return _stats;
1056} 1056}
1057 1057