summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-07 20:30:21 (UTC)
committer mickeyl <mickeyl>2004-01-07 20:30:21 (UTC)
commit49ae69c0f1d3a839492eb93e25bf83b7c7dc58a5 (patch) (unidiff)
tree78981f89d8e9d93766f9d04154ce1d485fbf975c
parentf1a1b0e56e676c655e9728d97cdf68d63df7f5d5 (diff)
downloadopie-49ae69c0f1d3a839492eb93e25bf83b7c7dc58a5.zip
opie-49ae69c0f1d3a839492eb93e25bf83b7c7dc58a5.tar.gz
opie-49ae69c0f1d3a839492eb93e25bf83b7c7dc58a5.tar.bz2
OWaveLanManagementSSID::ID() now can decloak SSIDs (caution:API change)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp13
-rw-r--r--libopie2/opienet/opcap.h2
-rw-r--r--libopie2/opienet/opienet.pro2
3 files changed, 13 insertions, 4 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 012c0a3..4d786f5 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -575,520 +575,529 @@ int OTCPPacket::window() const
575 return EXTRACT_16BITS( &_tcphdr->window ); 575 return EXTRACT_16BITS( &_tcphdr->window );
576} 576}
577 577
578 578
579int OTCPPacket::checksum() const 579int OTCPPacket::checksum() const
580{ 580{
581 return EXTRACT_16BITS( &_tcphdr->check ); 581 return EXTRACT_16BITS( &_tcphdr->check );
582} 582}
583 583
584/*====================================================================================== 584/*======================================================================================
585 * OPrismHeaderPacket 585 * OPrismHeaderPacket
586 *======================================================================================*/ 586 *======================================================================================*/
587 587
588 588
589OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent ) 589OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct prism_hdr* data, QObject* parent )
590 :QObject( parent, "Prism" ), _header( data ) 590 :QObject( parent, "Prism" ), _header( data )
591 591
592{ 592{
593 odebug << "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." << oendl; 593 odebug << "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." << oendl;
594 594
595 odebug << "Signal Strength = " << data->signal.data << oendl; 595 odebug << "Signal Strength = " << data->signal.data << oendl;
596 596
597 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this ); 597 new OWaveLanPacket( end, (const struct ieee_802_11_header*) (data+1), this );
598} 598}
599 599
600OPrismHeaderPacket::~OPrismHeaderPacket() 600OPrismHeaderPacket::~OPrismHeaderPacket()
601{ 601{
602} 602}
603 603
604 604
605unsigned int OPrismHeaderPacket::signalStrength() const 605unsigned int OPrismHeaderPacket::signalStrength() const
606{ 606{
607 return _header->signal.data; 607 return _header->signal.data;
608} 608}
609 609
610/*====================================================================================== 610/*======================================================================================
611 * OWaveLanPacket 611 * OWaveLanPacket
612 *======================================================================================*/ 612 *======================================================================================*/
613 613
614 614
615OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent ) 615OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_11_header* data, QObject* parent )
616 :QObject( parent, "802.11" ), _wlanhdr( data ) 616 :QObject( parent, "802.11" ), _wlanhdr( data )
617 617
618{ 618{
619 odebug << "OWaveLanPacket::OWaveLanPacket(): decoding IEEE 802.11 header..." << oendl; 619 odebug << "OWaveLanPacket::OWaveLanPacket(): decoding IEEE 802.11 header..." << oendl;
620 odebug << "type = " << type() << oendl; 620 odebug << "type = " << type() << oendl;
621 odebug << "subType = " << subType() << oendl; 621 odebug << "subType = " << subType() << oendl;
622 odebug << "duration = " << duration() << oendl; 622 odebug << "duration = " << duration() << oendl;
623 odebug << "powermanagement = " << usesPowerManagement() << oendl; 623 odebug << "powermanagement = " << usesPowerManagement() << oendl;
624 odebug << "payload is encrypted = " << ( usesWep() ? "yes" : "no" ) << oendl; 624 odebug << "payload is encrypted = " << ( usesWep() ? "yes" : "no" ) << oendl;
625 odebug << "MAC1 = " << macAddress1().toString() << oendl; 625 odebug << "MAC1 = " << macAddress1().toString() << oendl;
626 odebug << "MAC2 = " << macAddress2().toString() << oendl; 626 odebug << "MAC2 = " << macAddress2().toString() << oendl;
627 odebug << "MAC3 = " << macAddress3().toString() << oendl; 627 odebug << "MAC3 = " << macAddress3().toString() << oendl;
628 odebug << "MAC4 = " << macAddress4().toString() << oendl; 628 odebug << "MAC4 = " << macAddress4().toString() << oendl;
629 629
630 switch ( type() ) 630 switch ( type() )
631 { 631 {
632 case T_MGMT: new OWaveLanManagementPacket( end, (const struct ieee_802_11_mgmt_header*) data, this ); break; 632 case T_MGMT: new OWaveLanManagementPacket( end, (const struct ieee_802_11_mgmt_header*) data, this ); break;
633 case T_DATA: new OWaveLanDataPacket( end, (const struct ieee_802_11_data_header*) data, this ); break; 633 case T_DATA: new OWaveLanDataPacket( end, (const struct ieee_802_11_data_header*) data, this ); break;
634 case T_CTRL: new OWaveLanControlPacket( end, (const struct ieee_802_11_control_header*) data, this ); break; 634 case T_CTRL: new OWaveLanControlPacket( end, (const struct ieee_802_11_control_header*) data, this ); break;
635 default: odebug << "OWaveLanPacket::OWaveLanPacket(): Warning: Unknown major type = " << type() << oendl; 635 default: odebug << "OWaveLanPacket::OWaveLanPacket(): Warning: Unknown major type = " << type() << oendl;
636 } 636 }
637} 637}
638 638
639OWaveLanPacket::~OWaveLanPacket() 639OWaveLanPacket::~OWaveLanPacket()
640{ 640{
641} 641}
642 642
643 643
644int OWaveLanPacket::duration() const 644int OWaveLanPacket::duration() const
645{ 645{
646 return _wlanhdr->duration; 646 return _wlanhdr->duration;
647} 647}
648 648
649 649
650OMacAddress OWaveLanPacket::macAddress1() const 650OMacAddress OWaveLanPacket::macAddress1() const
651{ 651{
652 return OMacAddress( _wlanhdr->mac1 ); 652 return OMacAddress( _wlanhdr->mac1 );
653} 653}
654 654
655 655
656OMacAddress OWaveLanPacket::macAddress2() const 656OMacAddress OWaveLanPacket::macAddress2() const
657{ 657{
658 return OMacAddress( _wlanhdr->mac2 ); 658 return OMacAddress( _wlanhdr->mac2 );
659} 659}
660 660
661 661
662OMacAddress OWaveLanPacket::macAddress3() const 662OMacAddress OWaveLanPacket::macAddress3() const
663{ 663{
664 return OMacAddress( _wlanhdr->mac3 ); 664 return OMacAddress( _wlanhdr->mac3 );
665} 665}
666 666
667 667
668OMacAddress OWaveLanPacket::macAddress4() const 668OMacAddress OWaveLanPacket::macAddress4() const
669{ 669{
670 return OMacAddress( _wlanhdr->mac4 ); 670 return OMacAddress( _wlanhdr->mac4 );
671} 671}
672 672
673 673
674int OWaveLanPacket::subType() const 674int OWaveLanPacket::subType() const
675{ 675{
676 return FC_SUBTYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 676 return FC_SUBTYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
677} 677}
678 678
679 679
680int OWaveLanPacket::type() const 680int OWaveLanPacket::type() const
681{ 681{
682 return FC_TYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 682 return FC_TYPE( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
683} 683}
684 684
685 685
686int OWaveLanPacket::version() const 686int OWaveLanPacket::version() const
687{ 687{
688 return FC_VERSION( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 688 return FC_VERSION( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
689} 689}
690 690
691 691
692bool OWaveLanPacket::fromDS() const 692bool OWaveLanPacket::fromDS() const
693{ 693{
694 return FC_FROM_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 694 return FC_FROM_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
695} 695}
696 696
697 697
698bool OWaveLanPacket::toDS() const 698bool OWaveLanPacket::toDS() const
699{ 699{
700 return FC_TO_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 700 return FC_TO_DS( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
701} 701}
702 702
703 703
704bool OWaveLanPacket::usesPowerManagement() const 704bool OWaveLanPacket::usesPowerManagement() const
705{ 705{
706 return FC_POWER_MGMT( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 706 return FC_POWER_MGMT( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
707} 707}
708 708
709 709
710bool OWaveLanPacket::usesWep() const 710bool OWaveLanPacket::usesWep() const
711{ 711{
712 return FC_WEP( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) ); 712 return FC_WEP( EXTRACT_LE_16BITS( &_wlanhdr->frame_control ) );
713} 713}
714 714
715 715
716/*====================================================================================== 716/*======================================================================================
717 * OWaveLanManagementPacket 717 * OWaveLanManagementPacket
718 *======================================================================================*/ 718 *======================================================================================*/
719 719
720OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, const struct ieee_802_11_mgmt_header* data, OWaveLanPacket* parent ) 720OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, const struct ieee_802_11_mgmt_header* data, OWaveLanPacket* parent )
721 :QObject( parent, "802.11 Management" ), _header( data ), 721 :QObject( parent, "802.11 Management" ), _header( data ),
722 _body( (const struct ieee_802_11_mgmt_body*) (data+1) ) 722 _body( (const struct ieee_802_11_mgmt_body*) (data+1) )
723{ 723{
724 odebug << "OWaveLanManagementPacket::OWaveLanManagementPacket(): decoding frame..." << oendl; 724 odebug << "OWaveLanManagementPacket::OWaveLanManagementPacket(): decoding frame..." << oendl;
725 odebug << "Detected subtype is " << managementType() << oendl; 725 odebug << "Detected subtype is " << managementType() << oendl;
726 726
727 // grab tagged values 727 // grab tagged values
728 const unsigned char* ptr = (const unsigned char*) (_body+1); 728 const unsigned char* ptr = (const unsigned char*) (_body+1);
729 while (ptr < end) 729 while (ptr < end)
730 { 730 {
731 switch ( *ptr ) 731 switch ( *ptr )
732 { 732 {
733 case E_SSID: new OWaveLanManagementSSID( end, (struct ssid_t*) ptr, this ); break; 733 case E_SSID: new OWaveLanManagementSSID( end, (struct ssid_t*) ptr, this ); break;
734 case E_FH: new OWaveLanManagementFH( end, (struct fh_t*) ptr, this ); break; 734 case E_FH: new OWaveLanManagementFH( end, (struct fh_t*) ptr, this ); break;
735 case E_DS: new OWaveLanManagementDS( end, (struct ds_t*) ptr, this ); break; 735 case E_DS: new OWaveLanManagementDS( end, (struct ds_t*) ptr, this ); break;
736 case E_RATES: new OWaveLanManagementRates( end, (struct rates_t*) ptr, this ); break; 736 case E_RATES: new OWaveLanManagementRates( end, (struct rates_t*) ptr, this ); break;
737 case E_CF: new OWaveLanManagementCF( end, (struct cf_t*) ptr, this ); break; 737 case E_CF: new OWaveLanManagementCF( end, (struct cf_t*) ptr, this ); break;
738 case E_TIM: new OWaveLanManagementTim( end, (struct tim_t*) ptr, this ); break; 738 case E_TIM: new OWaveLanManagementTim( end, (struct tim_t*) ptr, this ); break;
739 case E_IBSS: new OWaveLanManagementIBSS( end, (struct ibss_t*) ptr, this ); break; 739 case E_IBSS: new OWaveLanManagementIBSS( end, (struct ibss_t*) ptr, this ); break;
740 case E_CHALLENGE: new OWaveLanManagementChallenge( end, (struct challenge_t*) ptr, this ); break; 740 case E_CHALLENGE: new OWaveLanManagementChallenge( end, (struct challenge_t*) ptr, this ); break;
741 } 741 }
742 ptr+= ( ( struct ssid_t* ) ptr )->length; // skip length of tagged value 742 ptr+= ( ( struct ssid_t* ) ptr )->length; // skip length of tagged value
743 ptr+= 2; // skip tag ID and length 743 ptr+= 2; // skip tag ID and length
744 } 744 }
745} 745}
746 746
747 747
748OWaveLanManagementPacket::~OWaveLanManagementPacket() 748OWaveLanManagementPacket::~OWaveLanManagementPacket()
749{ 749{
750} 750}
751 751
752 752
753QString OWaveLanManagementPacket::managementType() const 753QString OWaveLanManagementPacket::managementType() const
754{ 754{
755 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) ) 755 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) )
756 { 756 {
757 case ST_ASSOC_REQUEST: return "AssociationRequest"; break; 757 case ST_ASSOC_REQUEST: return "AssociationRequest"; break;
758 case ST_ASSOC_RESPONSE: return "AssociationResponse"; break; 758 case ST_ASSOC_RESPONSE: return "AssociationResponse"; break;
759 case ST_REASSOC_REQUEST: return "ReassociationRequest"; break; 759 case ST_REASSOC_REQUEST: return "ReassociationRequest"; break;
760 case ST_REASSOC_RESPONSE: return "ReassociationResponse"; break; 760 case ST_REASSOC_RESPONSE: return "ReassociationResponse"; break;
761 case ST_PROBE_REQUEST: return "ProbeRequest"; break; 761 case ST_PROBE_REQUEST: return "ProbeRequest"; break;
762 case ST_PROBE_RESPONSE: return "ProbeResponse"; break; 762 case ST_PROBE_RESPONSE: return "ProbeResponse"; break;
763 case ST_BEACON: return "Beacon"; break; 763 case ST_BEACON: return "Beacon"; break;
764 case ST_ATIM: return "Atim"; break; 764 case ST_ATIM: return "Atim"; break;
765 case ST_DISASSOC: return "Disassociation"; break; 765 case ST_DISASSOC: return "Disassociation"; break;
766 case ST_AUTH: return "Authentication"; break; 766 case ST_AUTH: return "Authentication"; break;
767 case ST_DEAUTH: return "Deathentication"; break; 767 case ST_DEAUTH: return "Deathentication"; break;
768 default: owarn << "OWaveLanManagementPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; return "Unknown"; 768 default: owarn << "OWaveLanManagementPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; return "Unknown";
769 } 769 }
770} 770}
771 771
772 772
773int OWaveLanManagementPacket::beaconInterval() const 773int OWaveLanManagementPacket::beaconInterval() const
774{ 774{
775 return EXTRACT_LE_16BITS( &_body->beacon_interval ); 775 return EXTRACT_LE_16BITS( &_body->beacon_interval );
776} 776}
777 777
778 778
779int OWaveLanManagementPacket::capabilities() const 779int OWaveLanManagementPacket::capabilities() const
780{ 780{
781 return EXTRACT_LE_16BITS( &_body->capability_info ); 781 return EXTRACT_LE_16BITS( &_body->capability_info );
782} 782}
783 783
784 784
785bool OWaveLanManagementPacket::canESS() const 785bool OWaveLanManagementPacket::canESS() const
786{ 786{
787 return CAPABILITY_ESS( EXTRACT_LE_16BITS( &_body->capability_info ) ); 787 return CAPABILITY_ESS( EXTRACT_LE_16BITS( &_body->capability_info ) );
788} 788}
789 789
790 790
791bool OWaveLanManagementPacket::canIBSS() const 791bool OWaveLanManagementPacket::canIBSS() const
792{ 792{
793 return CAPABILITY_IBSS( EXTRACT_LE_16BITS( &_body->capability_info ) ); 793 return CAPABILITY_IBSS( EXTRACT_LE_16BITS( &_body->capability_info ) );
794} 794}
795 795
796 796
797bool OWaveLanManagementPacket::canCFP() const 797bool OWaveLanManagementPacket::canCFP() const
798{ 798{
799 return CAPABILITY_CFP( EXTRACT_LE_16BITS( &_body->capability_info ) ); 799 return CAPABILITY_CFP( EXTRACT_LE_16BITS( &_body->capability_info ) );
800} 800}
801 801
802 802
803bool OWaveLanManagementPacket::canCFP_REQ() const 803bool OWaveLanManagementPacket::canCFP_REQ() const
804{ 804{
805 return CAPABILITY_CFP_REQ( EXTRACT_LE_16BITS( &_body->capability_info ) ); 805 return CAPABILITY_CFP_REQ( EXTRACT_LE_16BITS( &_body->capability_info ) );
806} 806}
807 807
808 808
809bool OWaveLanManagementPacket::canPrivacy() const 809bool OWaveLanManagementPacket::canPrivacy() const
810{ 810{
811 return CAPABILITY_PRIVACY( EXTRACT_LE_16BITS( &_body->capability_info ) ); 811 return CAPABILITY_PRIVACY( EXTRACT_LE_16BITS( &_body->capability_info ) );
812} 812}
813 813
814 814
815/*====================================================================================== 815/*======================================================================================
816 * OWaveLanManagementSSID 816 * OWaveLanManagementSSID
817 *======================================================================================*/ 817 *======================================================================================*/
818 818
819OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const struct ssid_t* data, QObject* parent ) 819OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const struct ssid_t* data, QObject* parent )
820 :QObject( parent, "802.11 SSID" ), _data( data ) 820 :QObject( parent, "802.11 SSID" ), _data( data )
821{ 821{
822 odebug << "OWaveLanManagementSSID()" << oendl; 822 odebug << "OWaveLanManagementSSID()" << oendl;
823} 823}
824 824
825 825
826OWaveLanManagementSSID::~OWaveLanManagementSSID() 826OWaveLanManagementSSID::~OWaveLanManagementSSID()
827{ 827{
828} 828}
829 829
830 830
831QString OWaveLanManagementSSID::ID() const 831QString OWaveLanManagementSSID::ID( bool decloak ) const
832{ 832{
833 int length = _data->length; 833 int length = _data->length;
834 if ( length > 32 ) length = 32; 834 if ( length > 32 ) length = 32;
835 char essid[length+1]; 835 char essid[length+1];
836 memcpy( &essid, &_data->ssid, length ); 836 memcpy( &essid, &_data->ssid, length );
837 essid[length] = 0x0; 837 essid[length] = 0x0;
838 return essid; 838 if ( !decloak || length < 2 || essid[0] != '\0' ) return essid;
839 odebug << "OWaveLanManagementSSID:ID(): SSID is cloaked - decloaking..." << oendl;
840
841 QString decloakedID;
842 for ( int i = 1; i < length; ++i )
843 {
844 if ( essid[i] >= 32 && essid[i] <= 126 ) decloakedID.append( essid[i] );
845 else decloakedID.append( '.' );
846 }
847 return decloakedID;
839} 848}
840 849
841 850
842/*====================================================================================== 851/*======================================================================================
843 * OWaveLanManagementRates 852 * OWaveLanManagementRates
844 *======================================================================================*/ 853 *======================================================================================*/
845 854
846OWaveLanManagementRates::OWaveLanManagementRates( const unsigned char* end, const struct rates_t* data, QObject* parent ) 855OWaveLanManagementRates::OWaveLanManagementRates( const unsigned char* end, const struct rates_t* data, QObject* parent )
847 :QObject( parent, "802.11 Rates" ), _data( data ) 856 :QObject( parent, "802.11 Rates" ), _data( data )
848{ 857{
849 odebug << "OWaveLanManagementRates()" << oendl; 858 odebug << "OWaveLanManagementRates()" << oendl;
850} 859}
851 860
852 861
853OWaveLanManagementRates::~OWaveLanManagementRates() 862OWaveLanManagementRates::~OWaveLanManagementRates()
854{ 863{
855} 864}
856 865
857/*====================================================================================== 866/*======================================================================================
858 * OWaveLanManagementCF 867 * OWaveLanManagementCF
859 *======================================================================================*/ 868 *======================================================================================*/
860 869
861OWaveLanManagementCF::OWaveLanManagementCF( const unsigned char* end, const struct cf_t* data, QObject* parent ) 870OWaveLanManagementCF::OWaveLanManagementCF( const unsigned char* end, const struct cf_t* data, QObject* parent )
862 :QObject( parent, "802.11 CF" ), _data( data ) 871 :QObject( parent, "802.11 CF" ), _data( data )
863{ 872{
864 odebug << "OWaveLanManagementCF()" << oendl; 873 odebug << "OWaveLanManagementCF()" << oendl;
865} 874}
866 875
867 876
868OWaveLanManagementCF::~OWaveLanManagementCF() 877OWaveLanManagementCF::~OWaveLanManagementCF()
869{ 878{
870} 879}
871 880
872/*====================================================================================== 881/*======================================================================================
873 * OWaveLanManagementFH 882 * OWaveLanManagementFH
874 *======================================================================================*/ 883 *======================================================================================*/
875 884
876OWaveLanManagementFH::OWaveLanManagementFH( const unsigned char* end, const struct fh_t* data, QObject* parent ) 885OWaveLanManagementFH::OWaveLanManagementFH( const unsigned char* end, const struct fh_t* data, QObject* parent )
877 :QObject( parent, "802.11 FH" ), _data( data ) 886 :QObject( parent, "802.11 FH" ), _data( data )
878{ 887{
879 odebug << "OWaveLanManagementFH()" << oendl; 888 odebug << "OWaveLanManagementFH()" << oendl;
880} 889}
881 890
882 891
883OWaveLanManagementFH::~OWaveLanManagementFH() 892OWaveLanManagementFH::~OWaveLanManagementFH()
884{ 893{
885} 894}
886 895
887/*====================================================================================== 896/*======================================================================================
888 * OWaveLanManagementDS 897 * OWaveLanManagementDS
889 *======================================================================================*/ 898 *======================================================================================*/
890 899
891OWaveLanManagementDS::OWaveLanManagementDS( const unsigned char* end, const struct ds_t* data, QObject* parent ) 900OWaveLanManagementDS::OWaveLanManagementDS( const unsigned char* end, const struct ds_t* data, QObject* parent )
892 :QObject( parent, "802.11 DS" ), _data( data ) 901 :QObject( parent, "802.11 DS" ), _data( data )
893{ 902{
894 odebug << "OWaveLanManagementDS()" << oendl; 903 odebug << "OWaveLanManagementDS()" << oendl;
895} 904}
896 905
897 906
898OWaveLanManagementDS::~OWaveLanManagementDS() 907OWaveLanManagementDS::~OWaveLanManagementDS()
899{ 908{
900} 909}
901 910
902 911
903int OWaveLanManagementDS::channel() const 912int OWaveLanManagementDS::channel() const
904{ 913{
905 return _data->channel; 914 return _data->channel;
906} 915}
907 916
908/*====================================================================================== 917/*======================================================================================
909 * OWaveLanManagementTim 918 * OWaveLanManagementTim
910 *======================================================================================*/ 919 *======================================================================================*/
911 920
912OWaveLanManagementTim::OWaveLanManagementTim( const unsigned char* end, const struct tim_t* data, QObject* parent ) 921OWaveLanManagementTim::OWaveLanManagementTim( const unsigned char* end, const struct tim_t* data, QObject* parent )
913 :QObject( parent, "802.11 Tim" ), _data( data ) 922 :QObject( parent, "802.11 Tim" ), _data( data )
914{ 923{
915 odebug << "OWaveLanManagementTim()" << oendl; 924 odebug << "OWaveLanManagementTim()" << oendl;
916} 925}
917 926
918 927
919OWaveLanManagementTim::~OWaveLanManagementTim() 928OWaveLanManagementTim::~OWaveLanManagementTim()
920{ 929{
921} 930}
922 931
923/*====================================================================================== 932/*======================================================================================
924 * OWaveLanManagementIBSS 933 * OWaveLanManagementIBSS
925 *======================================================================================*/ 934 *======================================================================================*/
926 935
927OWaveLanManagementIBSS::OWaveLanManagementIBSS( const unsigned char* end, const struct ibss_t* data, QObject* parent ) 936OWaveLanManagementIBSS::OWaveLanManagementIBSS( const unsigned char* end, const struct ibss_t* data, QObject* parent )
928 :QObject( parent, "802.11 IBSS" ), _data( data ) 937 :QObject( parent, "802.11 IBSS" ), _data( data )
929{ 938{
930 odebug << "OWaveLanManagementIBSS()" << oendl; 939 odebug << "OWaveLanManagementIBSS()" << oendl;
931} 940}
932 941
933 942
934OWaveLanManagementIBSS::~OWaveLanManagementIBSS() 943OWaveLanManagementIBSS::~OWaveLanManagementIBSS()
935{ 944{
936} 945}
937 946
938/*====================================================================================== 947/*======================================================================================
939 * OWaveLanManagementChallenge 948 * OWaveLanManagementChallenge
940 *======================================================================================*/ 949 *======================================================================================*/
941 950
942OWaveLanManagementChallenge::OWaveLanManagementChallenge( const unsigned char* end, const struct challenge_t* data, QObject* parent ) 951OWaveLanManagementChallenge::OWaveLanManagementChallenge( const unsigned char* end, const struct challenge_t* data, QObject* parent )
943 :QObject( parent, "802.11 Challenge" ), _data( data ) 952 :QObject( parent, "802.11 Challenge" ), _data( data )
944{ 953{
945 odebug << "OWaveLanManagementChallenge()" << oendl; 954 odebug << "OWaveLanManagementChallenge()" << oendl;
946} 955}
947 956
948 957
949OWaveLanManagementChallenge::~OWaveLanManagementChallenge() 958OWaveLanManagementChallenge::~OWaveLanManagementChallenge()
950{ 959{
951} 960}
952 961
953/*====================================================================================== 962/*======================================================================================
954 * OWaveLanDataPacket 963 * OWaveLanDataPacket
955 *======================================================================================*/ 964 *======================================================================================*/
956 965
957OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent ) 966OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent )
958 :QObject( parent, "802.11 Data" ), _header( data ) 967 :QObject( parent, "802.11 Data" ), _header( data )
959{ 968{
960 odebug << "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." << oendl; 969 odebug << "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." << oendl;
961 970
962 const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header ); 971 const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header );
963 972
964 #warning The next line works for most cases, but can not be correct generally! 973 #warning The next line works for most cases, but can not be correct generally!
965 if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address 974 if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address
966 975
967 new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this ); 976 new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this );
968} 977}
969 978
970 979
971OWaveLanDataPacket::~OWaveLanDataPacket() 980OWaveLanDataPacket::~OWaveLanDataPacket()
972{ 981{
973} 982}
974 983
975 984
976/*====================================================================================== 985/*======================================================================================
977 * OLLCPacket 986 * OLLCPacket
978 *======================================================================================*/ 987 *======================================================================================*/
979 988
980OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent ) 989OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent )
981 :QObject( parent, "802.11 LLC" ), _header( data ) 990 :QObject( parent, "802.11 LLC" ), _header( data )
982{ 991{
983 odebug << "OLLCPacket::OLLCPacket(): decoding frame..." << oendl; 992 odebug << "OLLCPacket::OLLCPacket(): decoding frame..." << oendl;
984 993
985 if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) ) 994 if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) )
986 { 995 {
987 owarn << "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type = " << EXTRACT_16BITS( &_header->type ) << ")" << oendl; 996 owarn << "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type = " << EXTRACT_16BITS( &_header->type ) << ")" << oendl;
988 997
989 switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h 998 switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h
990 { 999 {
991 case ETH_P_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break; 1000 case ETH_P_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break;
992 case ETH_P_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break; 1001 case ETH_P_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break;
993 default: owarn << "OLLCPacket::OLLCPacket(): Unknown Encapsulation type = " << EXTRACT_16BITS( &_header->type ) << oendl; 1002 default: owarn << "OLLCPacket::OLLCPacket(): Unknown Encapsulation type = " << EXTRACT_16BITS( &_header->type ) << oendl;
994 } 1003 }
995 } 1004 }
996} 1005}
997 1006
998 1007
999OLLCPacket::~OLLCPacket() 1008OLLCPacket::~OLLCPacket()
1000{ 1009{
1001} 1010}
1002 1011
1003 1012
1004/*====================================================================================== 1013/*======================================================================================
1005 * OWaveLanControlPacket 1014 * OWaveLanControlPacket
1006 *======================================================================================*/ 1015 *======================================================================================*/
1007 1016
1008OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const struct ieee_802_11_control_header* data, OWaveLanPacket* parent ) 1017OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const struct ieee_802_11_control_header* data, OWaveLanPacket* parent )
1009 :QObject( parent, "802.11 Control" ), _header( data ) 1018 :QObject( parent, "802.11 Control" ), _header( data )
1010{ 1019{
1011 odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl; 1020 odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl;
1012 odebug << "Detected subtype is " << controlType() << oendl; 1021 odebug << "Detected subtype is " << controlType() << oendl;
1013} 1022}
1014 1023
1015 1024
1016OWaveLanControlPacket::~OWaveLanControlPacket() 1025OWaveLanControlPacket::~OWaveLanControlPacket()
1017{ 1026{
1018} 1027}
1019 1028
1020 1029
1021QString OWaveLanControlPacket::controlType() const 1030QString OWaveLanControlPacket::controlType() const
1022{ 1031{
1023 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) ) 1032 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) )
1024 { 1033 {
1025 case CTRL_PS_POLL: return "PowerSavePoll"; break; 1034 case CTRL_PS_POLL: return "PowerSavePoll"; break;
1026 case CTRL_RTS: return "RequestToSend"; break; 1035 case CTRL_RTS: return "RequestToSend"; break;
1027 case CTRL_CTS: return "ClearToSend"; break; 1036 case CTRL_CTS: return "ClearToSend"; break;
1028 case CTRL_ACK: return "Acknowledge"; break; 1037 case CTRL_ACK: return "Acknowledge"; break;
1029 case CTRL_CF_END: return "ContentionFreeEnd"; break; 1038 case CTRL_CF_END: return "ContentionFreeEnd"; break;
1030 case CTRL_END_ACK: return "AcknowledgeEnd"; break; 1039 case CTRL_END_ACK: return "AcknowledgeEnd"; break;
1031 default: 1040 default:
1032 owarn << "OWaveLanControlPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; 1041 owarn << "OWaveLanControlPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl;
1033 return "Unknown"; 1042 return "Unknown";
1034 } 1043 }
1035} 1044}
1036 1045
1037 1046
1038/*====================================================================================== 1047/*======================================================================================
1039 * OPacketCapturer 1048 * OPacketCapturer
1040 *======================================================================================*/ 1049 *======================================================================================*/
1041 1050
1042OPacketCapturer::OPacketCapturer( QObject* parent, const char* name ) 1051OPacketCapturer::OPacketCapturer( QObject* parent, const char* name )
1043 :QObject( parent, name ), _name( QString::null ), _open( false ), _pch( 0 ), _pcd( 0 ), _sn( 0 ) 1052 :QObject( parent, name ), _name( QString::null ), _open( false ), _pch( 0 ), _pcd( 0 ), _sn( 0 )
1044{ 1053{
1045} 1054}
1046 1055
1047 1056
1048OPacketCapturer::~OPacketCapturer() 1057OPacketCapturer::~OPacketCapturer()
1049{ 1058{
1050 if ( _open ) 1059 if ( _open )
1051 { 1060 {
1052 odebug << "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." << oendl; 1061 odebug << "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." << oendl;
1053 close(); 1062 close();
1054 } 1063 }
1055} 1064}
1056 1065
1057 1066
1058void OPacketCapturer::setBlocking( bool b ) 1067void OPacketCapturer::setBlocking( bool b )
1059{ 1068{
1060 if ( pcap_setnonblock( _pch, 1-b, _errbuf ) != -1 ) 1069 if ( pcap_setnonblock( _pch, 1-b, _errbuf ) != -1 )
1061 { 1070 {
1062 odebug << "OPacketCapturer::setBlocking(): blocking mode changed successfully." << oendl; 1071 odebug << "OPacketCapturer::setBlocking(): blocking mode changed successfully." << oendl;
1063 } 1072 }
1064 else 1073 else
1065 { 1074 {
1066 odebug << "OPacketCapturer::setBlocking(): can't change blocking mode: " << _errbuf << oendl; 1075 odebug << "OPacketCapturer::setBlocking(): can't change blocking mode: " << _errbuf << oendl;
1067 } 1076 }
1068} 1077}
1069 1078
1070 1079
1071bool OPacketCapturer::blocking() const 1080bool OPacketCapturer::blocking() const
1072{ 1081{
1073 int b = pcap_getnonblock( _pch, _errbuf ); 1082 int b = pcap_getnonblock( _pch, _errbuf );
1074 if ( b == -1 ) 1083 if ( b == -1 )
1075 { 1084 {
1076 odebug << "OPacketCapturer::blocking(): can't get blocking mode: " << _errbuf << oendl; 1085 odebug << "OPacketCapturer::blocking(): can't get blocking mode: " << _errbuf << oendl;
1077 return -1; 1086 return -1;
1078 } 1087 }
1079 return !b; 1088 return !b;
1080} 1089}
1081 1090
1082 1091
1083void OPacketCapturer::closeDumpFile() 1092void OPacketCapturer::closeDumpFile()
1084{ 1093{
1085 if ( _pcd ) 1094 if ( _pcd )
1086 { 1095 {
1087 pcap_dump_close( _pcd ); 1096 pcap_dump_close( _pcd );
1088 _pcd = 0; 1097 _pcd = 0;
1089 } 1098 }
1090 pcap_close( _pch ); 1099 pcap_close( _pch );
1091} 1100}
1092 1101
1093 1102
1094void OPacketCapturer::close() 1103void OPacketCapturer::close()
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index b373c56..f5dc5c0 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -1,508 +1,508 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OPCAP_H 31#ifndef OPCAP_H
32#define OPCAP_H 32#define OPCAP_H
33 33
34/* LINUX */ 34/* LINUX */
35extern "C" // work around a bpf/pcap conflict in recent headers 35extern "C" // work around a bpf/pcap conflict in recent headers
36{ 36{
37 #include <pcap.h> 37 #include <pcap.h>
38} 38}
39#include <netinet/ether.h> 39#include <netinet/ether.h>
40#include <netinet/ip.h> 40#include <netinet/ip.h>
41#include <netinet/udp.h> 41#include <netinet/udp.h>
42#include <netinet/tcp.h> 42#include <netinet/tcp.h>
43#include <time.h> 43#include <time.h>
44 44
45/* QT */ 45/* QT */
46#include <qevent.h> 46#include <qevent.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qhostaddress.h> 48#include <qhostaddress.h>
49#include <qobject.h> 49#include <qobject.h>
50#include <qstring.h> 50#include <qstring.h>
51#include <qmap.h> 51#include <qmap.h>
52 52
53/* OPIE */ 53/* OPIE */
54#include <opie2/onetutils.h> 54#include <opie2/onetutils.h>
55 55
56/* Custom Network Includes */ 56/* Custom Network Includes */
57#include "802_11_user.h" 57#include "802_11_user.h"
58#include "dhcp.h" 58#include "dhcp.h"
59 59
60/* TYPEDEFS */ 60/* TYPEDEFS */
61typedef struct timeval timevalstruct; 61typedef struct timeval timevalstruct;
62typedef struct pcap_pkthdr packetheaderstruct; 62typedef struct pcap_pkthdr packetheaderstruct;
63 63
64/* FORWARDS */ 64/* FORWARDS */
65class OPacketCapturer; 65class OPacketCapturer;
66class QSocketNotifier; 66class QSocketNotifier;
67 67
68/*====================================================================================== 68/*======================================================================================
69 * OPacket - A frame on the wire 69 * OPacket - A frame on the wire
70 *======================================================================================*/ 70 *======================================================================================*/
71 71
72/** @brief A class representing a data frame on the wire. 72/** @brief A class representing a data frame on the wire.
73 * 73 *
74 * The whole family of the packet classes are used when capturing frames from a network. 74 * The whole family of the packet classes are used when capturing frames from a network.
75 * Most standard network protocols in use share a common architecture, which mostly is 75 * Most standard network protocols in use share a common architecture, which mostly is
76 * a packet header and then the packet payload. In layered architectures, each lower layer 76 * a packet header and then the packet payload. In layered architectures, each lower layer
77 * encapsulates data from its upper layer - that is it 77 * encapsulates data from its upper layer - that is it
78 * treats the data from its upper layer as payload and prepends an own header to the packet, 78 * treats the data from its upper layer as payload and prepends an own header to the packet,
79 * which - again - is treated as the payload for the layer below. The figure below is an 79 * which - again - is treated as the payload for the layer below. The figure below is an
80 * example for how such a data frame is composed out of packets, e.g. when sending a mail. 80 * example for how such a data frame is composed out of packets, e.g. when sending a mail.
81 * 81 *
82 * <pre> 82 * <pre>
83 * | User Data | == Mail Data 83 * | User Data | == Mail Data
84 * | SMTP Header | User Data | == SMTP 84 * | SMTP Header | User Data | == SMTP
85 * | TCP Header | SMTP Header | User Data | == TCP 85 * | TCP Header | SMTP Header | User Data | == TCP
86 * | IP Header | TCP Header | SMTP Header | User Data | == IP 86 * | IP Header | TCP Header | SMTP Header | User Data | == IP
87 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC 87 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC
88 * 88 *
89 * </pre> 89 * </pre>
90 * 90 *
91 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer 91 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer
92 * also contains a few more levels of encapsulation. 92 * also contains a few more levels of encapsulation.
93 * Since the type of the payload is more or less independent from the encapsulating protocol, 93 * Since the type of the payload is more or less independent from the encapsulating protocol,
94 * the header must be inspected before attempting to decode the payload. Hence, the 94 * the header must be inspected before attempting to decode the payload. Hence, the
95 * encapsulation level varies and can't be deduced without actually looking into the packets. 95 * encapsulation level varies and can't be deduced without actually looking into the packets.
96 * 96 *
97 * For actually working with captured frames, it's useful to identify the packets via names and 97 * For actually working with captured frames, it's useful to identify the packets via names and
98 * insert them into a parent/child - relationship based on the encapsulation. This is why 98 * insert them into a parent/child - relationship based on the encapsulation. This is why
99 * all packet classes derive from QObject. The amount of overhead caused by the QObject is 99 * all packet classes derive from QObject. The amount of overhead caused by the QObject is
100 * not a problem in this case, because we're talking about a theoratical maximum of about 100 * not a problem in this case, because we're talking about a theoratical maximum of about
101 * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the 101 * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the
102 * QObject also cares about destroying the sub-, (child-) packets. 102 * QObject also cares about destroying the sub-, (child-) packets.
103 * 103 *
104 * This enables us to perform a simple look for packets of a certain type: 104 * This enables us to perform a simple look for packets of a certain type:
105 * @code 105 * @code
106 * OPacketCapturer* pcap = new OPacketCapturer(); 106 * OPacketCapturer* pcap = new OPacketCapturer();
107 * pcap->open( "eth0" ); 107 * pcap->open( "eth0" );
108 * OPacket* p = pcap->next(); 108 * OPacket* p = pcap->next();
109 * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists 109 * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists
110 * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl; 110 * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl;
111 * 111 *
112 */ 112 */
113 113
114class OPacket : public QObject 114class OPacket : public QObject
115{ 115{
116 Q_OBJECT 116 Q_OBJECT
117 117
118 friend class OPacketCapturer; 118 friend class OPacketCapturer;
119 119
120 public: 120 public:
121 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); 121 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent );
122 virtual ~OPacket(); 122 virtual ~OPacket();
123 123
124 timevalstruct timeval() const; 124 timevalstruct timeval() const;
125 125
126 int caplen() const; 126 int caplen() const;
127 int len() const; 127 int len() const;
128 QString dump( int = 32 ) const; 128 QString dump( int = 32 ) const;
129 129
130 void updateStats( QMap<QString,int>&, QObjectList* ); 130 void updateStats( QMap<QString,int>&, QObjectList* );
131 131
132 private: 132 private:
133 133
134 void dumpStructure( QObjectList* ); 134 void dumpStructure( QObjectList* );
135 QString _dumpStructure( QObjectList* ); 135 QString _dumpStructure( QObjectList* );
136 136
137 private: 137 private:
138 const packetheaderstruct _hdr; // pcap packet header 138 const packetheaderstruct _hdr; // pcap packet header
139 const unsigned char* _data; // pcap packet data 139 const unsigned char* _data; // pcap packet data
140 const unsigned char* _end; // end of pcap packet data 140 const unsigned char* _end; // end of pcap packet data
141}; 141};
142 142
143/*====================================================================================== 143/*======================================================================================
144 * OEthernetPacket - DLT_EN10MB frame 144 * OEthernetPacket - DLT_EN10MB frame
145 *======================================================================================*/ 145 *======================================================================================*/
146 146
147class OEthernetPacket : public QObject 147class OEthernetPacket : public QObject
148{ 148{
149 Q_OBJECT 149 Q_OBJECT
150 150
151 public: 151 public:
152 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); 152 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 );
153 virtual ~OEthernetPacket(); 153 virtual ~OEthernetPacket();
154 154
155 OMacAddress sourceAddress() const; 155 OMacAddress sourceAddress() const;
156 OMacAddress destinationAddress() const; 156 OMacAddress destinationAddress() const;
157 int type() const; 157 int type() const;
158 158
159 private: 159 private:
160 const struct ether_header* _ether; 160 const struct ether_header* _ether;
161}; 161};
162 162
163/*====================================================================================== 163/*======================================================================================
164 * OPrismHeaderPacket - DLT_PRISM_HEADER frame 164 * OPrismHeaderPacket - DLT_PRISM_HEADER frame
165 *======================================================================================*/ 165 *======================================================================================*/
166 166
167class OPrismHeaderPacket : public QObject 167class OPrismHeaderPacket : public QObject
168{ 168{
169 Q_OBJECT 169 Q_OBJECT
170 170
171 public: 171 public:
172 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); 172 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 );
173 virtual ~OPrismHeaderPacket(); 173 virtual ~OPrismHeaderPacket();
174 174
175 unsigned int signalStrength() const; 175 unsigned int signalStrength() const;
176 176
177 private: 177 private:
178 const struct prism_hdr* _header; 178 const struct prism_hdr* _header;
179}; 179};
180 180
181/*====================================================================================== 181/*======================================================================================
182 * OWaveLanPacket - DLT_IEEE802_11 frame 182 * OWaveLanPacket - DLT_IEEE802_11 frame
183 *======================================================================================*/ 183 *======================================================================================*/
184 184
185class OWaveLanPacket : public QObject 185class OWaveLanPacket : public QObject
186{ 186{
187 Q_OBJECT 187 Q_OBJECT
188 188
189 public: 189 public:
190 OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); 190 OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 );
191 virtual ~OWaveLanPacket(); 191 virtual ~OWaveLanPacket();
192 192
193 int duration() const; 193 int duration() const;
194 bool fromDS() const; 194 bool fromDS() const;
195 bool toDS() const; 195 bool toDS() const;
196 virtual OMacAddress macAddress1() const; 196 virtual OMacAddress macAddress1() const;
197 virtual OMacAddress macAddress2() const; 197 virtual OMacAddress macAddress2() const;
198 virtual OMacAddress macAddress3() const; 198 virtual OMacAddress macAddress3() const;
199 virtual OMacAddress macAddress4() const; 199 virtual OMacAddress macAddress4() const;
200 bool usesPowerManagement() const; 200 bool usesPowerManagement() const;
201 int type() const; 201 int type() const;
202 int subType() const; 202 int subType() const;
203 int version() const; 203 int version() const;
204 bool usesWep() const; 204 bool usesWep() const;
205 205
206 private: 206 private:
207 const struct ieee_802_11_header* _wlanhdr; 207 const struct ieee_802_11_header* _wlanhdr;
208}; 208};
209 209
210 210
211/*====================================================================================== 211/*======================================================================================
212 * OWaveLanManagementPacket - type: management (T_MGMT) 212 * OWaveLanManagementPacket - type: management (T_MGMT)
213 *======================================================================================*/ 213 *======================================================================================*/
214 214
215class OWaveLanManagementPacket : public QObject 215class OWaveLanManagementPacket : public QObject
216{ 216{
217 Q_OBJECT 217 Q_OBJECT
218 218
219 public: 219 public:
220 OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); 220 OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 );
221 virtual ~OWaveLanManagementPacket(); 221 virtual ~OWaveLanManagementPacket();
222 222
223 QString managementType() const; 223 QString managementType() const;
224 224
225 int beaconInterval() const; 225 int beaconInterval() const;
226 int capabilities() const; // generic 226 int capabilities() const; // generic
227 227
228 bool canESS() const; 228 bool canESS() const;
229 bool canIBSS() const; 229 bool canIBSS() const;
230 bool canCFP() const; 230 bool canCFP() const;
231 bool canCFP_REQ() const; 231 bool canCFP_REQ() const;
232 bool canPrivacy() const; 232 bool canPrivacy() const;
233 233
234 private: 234 private:
235 const struct ieee_802_11_mgmt_header* _header; 235 const struct ieee_802_11_mgmt_header* _header;
236 const struct ieee_802_11_mgmt_body* _body; 236 const struct ieee_802_11_mgmt_body* _body;
237}; 237};
238 238
239 239
240/*====================================================================================== 240/*======================================================================================
241 * OWaveLanManagementSSID 241 * OWaveLanManagementSSID
242 *======================================================================================*/ 242 *======================================================================================*/
243 243
244class OWaveLanManagementSSID : public QObject 244class OWaveLanManagementSSID : public QObject
245{ 245{
246 Q_OBJECT 246 Q_OBJECT
247 247
248 public: 248 public:
249 OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); 249 OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 );
250 virtual ~OWaveLanManagementSSID(); 250 virtual ~OWaveLanManagementSSID();
251 251
252 QString ID() const; 252 QString ID( bool decloak = false ) const;
253 253
254 private: 254 private:
255 const struct ssid_t* _data; 255 const struct ssid_t* _data;
256}; 256};
257 257
258/*====================================================================================== 258/*======================================================================================
259 * OWaveLanManagementRates 259 * OWaveLanManagementRates
260 *======================================================================================*/ 260 *======================================================================================*/
261 261
262class OWaveLanManagementRates : public QObject 262class OWaveLanManagementRates : public QObject
263{ 263{
264 Q_OBJECT 264 Q_OBJECT
265 265
266 public: 266 public:
267 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); 267 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 );
268 virtual ~OWaveLanManagementRates(); 268 virtual ~OWaveLanManagementRates();
269 269
270 private: 270 private:
271 const struct rates_t* _data; 271 const struct rates_t* _data;
272}; 272};
273 273
274/*====================================================================================== 274/*======================================================================================
275 * OWaveLanManagementCF 275 * OWaveLanManagementCF
276 *======================================================================================*/ 276 *======================================================================================*/
277 277
278class OWaveLanManagementCF : public QObject 278class OWaveLanManagementCF : public QObject
279{ 279{
280 Q_OBJECT 280 Q_OBJECT
281 281
282 public: 282 public:
283 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); 283 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 );
284 virtual ~OWaveLanManagementCF(); 284 virtual ~OWaveLanManagementCF();
285 285
286 private: 286 private:
287 const struct cf_t* _data; 287 const struct cf_t* _data;
288}; 288};
289 289
290/*====================================================================================== 290/*======================================================================================
291 * OWaveLanManagementFH 291 * OWaveLanManagementFH
292 *======================================================================================*/ 292 *======================================================================================*/
293 293
294class OWaveLanManagementFH : public QObject 294class OWaveLanManagementFH : public QObject
295{ 295{
296 Q_OBJECT 296 Q_OBJECT
297 297
298 public: 298 public:
299 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); 299 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 );
300 virtual ~OWaveLanManagementFH(); 300 virtual ~OWaveLanManagementFH();
301 301
302 private: 302 private:
303 const struct fh_t* _data; 303 const struct fh_t* _data;
304}; 304};
305 305
306/*====================================================================================== 306/*======================================================================================
307 * OWaveLanManagementDS 307 * OWaveLanManagementDS
308 *======================================================================================*/ 308 *======================================================================================*/
309 309
310class OWaveLanManagementDS : public QObject 310class OWaveLanManagementDS : public QObject
311{ 311{
312 Q_OBJECT 312 Q_OBJECT
313 313
314 public: 314 public:
315 OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); 315 OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 );
316 virtual ~OWaveLanManagementDS(); 316 virtual ~OWaveLanManagementDS();
317 317
318 int channel() const; 318 int channel() const;
319 319
320 private: 320 private:
321 const struct ds_t* _data; 321 const struct ds_t* _data;
322}; 322};
323 323
324/*====================================================================================== 324/*======================================================================================
325 * OWaveLanManagementTim 325 * OWaveLanManagementTim
326 *======================================================================================*/ 326 *======================================================================================*/
327 327
328class OWaveLanManagementTim : public QObject 328class OWaveLanManagementTim : public QObject
329{ 329{
330 Q_OBJECT 330 Q_OBJECT
331 331
332 public: 332 public:
333 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); 333 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 );
334 virtual ~OWaveLanManagementTim(); 334 virtual ~OWaveLanManagementTim();
335 335
336 private: 336 private:
337 const struct tim_t* _data; 337 const struct tim_t* _data;
338}; 338};
339 339
340/*====================================================================================== 340/*======================================================================================
341 * OWaveLanManagementIBSS 341 * OWaveLanManagementIBSS
342 *======================================================================================*/ 342 *======================================================================================*/
343 343
344class OWaveLanManagementIBSS : public QObject 344class OWaveLanManagementIBSS : public QObject
345{ 345{
346 Q_OBJECT 346 Q_OBJECT
347 347
348 public: 348 public:
349 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); 349 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 );
350 virtual ~OWaveLanManagementIBSS(); 350 virtual ~OWaveLanManagementIBSS();
351 351
352 private: 352 private:
353 const struct ibss_t* _data; 353 const struct ibss_t* _data;
354}; 354};
355 355
356/*====================================================================================== 356/*======================================================================================
357 * OWaveLanManagementChallenge 357 * OWaveLanManagementChallenge
358 *======================================================================================*/ 358 *======================================================================================*/
359 359
360class OWaveLanManagementChallenge : public QObject 360class OWaveLanManagementChallenge : public QObject
361{ 361{
362 Q_OBJECT 362 Q_OBJECT
363 363
364 public: 364 public:
365 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); 365 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 );
366 virtual ~OWaveLanManagementChallenge(); 366 virtual ~OWaveLanManagementChallenge();
367 367
368 private: 368 private:
369 const struct challenge_t* _data; 369 const struct challenge_t* _data;
370}; 370};
371 371
372/*====================================================================================== 372/*======================================================================================
373 * OWaveLanDataPacket - type: data (T_DATA) 373 * OWaveLanDataPacket - type: data (T_DATA)
374 *======================================================================================*/ 374 *======================================================================================*/
375 375
376class OWaveLanDataPacket : public QObject 376class OWaveLanDataPacket : public QObject
377{ 377{
378 Q_OBJECT 378 Q_OBJECT
379 379
380 public: 380 public:
381 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); 381 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 );
382 virtual ~OWaveLanDataPacket(); 382 virtual ~OWaveLanDataPacket();
383 383
384 private: 384 private:
385 const struct ieee_802_11_data_header* _header; 385 const struct ieee_802_11_data_header* _header;
386}; 386};
387 387
388/*====================================================================================== 388/*======================================================================================
389 * OWaveLanControlPacket - type: control (T_CTRL) 389 * OWaveLanControlPacket - type: control (T_CTRL)
390 *======================================================================================*/ 390 *======================================================================================*/
391 391
392class OWaveLanControlPacket : public QObject 392class OWaveLanControlPacket : public QObject
393{ 393{
394 Q_OBJECT 394 Q_OBJECT
395 395
396 public: 396 public:
397 OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); 397 OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 );
398 virtual ~OWaveLanControlPacket(); 398 virtual ~OWaveLanControlPacket();
399 399
400 QString controlType() const; 400 QString controlType() const;
401 401
402 private: 402 private:
403 const struct ieee_802_11_control_header* _header; 403 const struct ieee_802_11_control_header* _header;
404}; 404};
405 405
406/*====================================================================================== 406/*======================================================================================
407 * OLLCPacket - IEEE 802.2 Link Level Control 407 * OLLCPacket - IEEE 802.2 Link Level Control
408 *======================================================================================*/ 408 *======================================================================================*/
409 409
410class OLLCPacket : public QObject 410class OLLCPacket : public QObject
411{ 411{
412 Q_OBJECT 412 Q_OBJECT
413 413
414 public: 414 public:
415 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); 415 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 );
416 virtual ~OLLCPacket(); 416 virtual ~OLLCPacket();
417 417
418 private: 418 private:
419 const struct ieee_802_11_802_2_header* _header; 419 const struct ieee_802_11_802_2_header* _header;
420}; 420};
421 421
422/*====================================================================================== 422/*======================================================================================
423 * OIPPacket 423 * OIPPacket
424 *======================================================================================*/ 424 *======================================================================================*/
425 425
426class OIPPacket : public QObject 426class OIPPacket : public QObject
427{ 427{
428 Q_OBJECT 428 Q_OBJECT
429 429
430 public: 430 public:
431 OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); 431 OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 );
432 virtual ~OIPPacket(); 432 virtual ~OIPPacket();
433 433
434 QHostAddress fromIPAddress() const; 434 QHostAddress fromIPAddress() const;
435 QHostAddress toIPAddress() const; 435 QHostAddress toIPAddress() const;
436 436
437 int tos() const; 437 int tos() const;
438 int len() const; 438 int len() const;
439 int id() const; 439 int id() const;
440 int offset() const; 440 int offset() const;
441 int ttl() const; 441 int ttl() const;
442 int protocol() const; 442 int protocol() const;
443 int checksum() const; 443 int checksum() const;
444 444
445 private: 445 private:
446 const struct iphdr* _iphdr; 446 const struct iphdr* _iphdr;
447}; 447};
448 448
449/*====================================================================================== 449/*======================================================================================
450 * OARPPacket 450 * OARPPacket
451 *======================================================================================*/ 451 *======================================================================================*/
452 452
453class OARPPacket : public QObject 453class OARPPacket : public QObject
454{ 454{
455 Q_OBJECT 455 Q_OBJECT
456 456
457 public: 457 public:
458 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); 458 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 );
459 virtual ~OARPPacket(); 459 virtual ~OARPPacket();
460 460
461 QHostAddress senderIPV4Address() const; 461 QHostAddress senderIPV4Address() const;
462 OMacAddress senderMacAddress() const; 462 OMacAddress senderMacAddress() const;
463 QHostAddress targetIPV4Address() const; 463 QHostAddress targetIPV4Address() const;
464 OMacAddress targetMacAddress() const; 464 OMacAddress targetMacAddress() const;
465 465
466 //int type() const; 466 //int type() const;
467 QString type() const; 467 QString type() const;
468 468
469 private: 469 private:
470 const struct myarphdr* _arphdr; 470 const struct myarphdr* _arphdr;
471}; 471};
472 472
473/*====================================================================================== 473/*======================================================================================
474 * OUDPPacket 474 * OUDPPacket
475 *======================================================================================*/ 475 *======================================================================================*/
476 476
477class OUDPPacket : public QObject 477class OUDPPacket : public QObject
478{ 478{
479 Q_OBJECT 479 Q_OBJECT
480 480
481 public: 481 public:
482 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); 482 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 );
483 virtual ~OUDPPacket(); 483 virtual ~OUDPPacket();
484 484
485 int fromPort() const; 485 int fromPort() const;
486 int toPort() const; 486 int toPort() const;
487 int length() const; 487 int length() const;
488 int checksum() const; 488 int checksum() const;
489 489
490 private: 490 private:
491 const struct udphdr* _udphdr; 491 const struct udphdr* _udphdr;
492}; 492};
493 493
494/*====================================================================================== 494/*======================================================================================
495 * ODHCPPacket 495 * ODHCPPacket
496 *======================================================================================*/ 496 *======================================================================================*/
497 497
498class ODHCPPacket : public QObject 498class ODHCPPacket : public QObject
499{ 499{
500 Q_OBJECT 500 Q_OBJECT
501 501
502 public: 502 public:
503 ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); 503 ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 );
504 virtual ~ODHCPPacket(); 504 virtual ~ODHCPPacket();
505 505
506 QHostAddress clientAddress() const; 506 QHostAddress clientAddress() const;
507 QHostAddress yourAddress() const; 507 QHostAddress yourAddress() const;
508 QHostAddress serverAddress() const; 508 QHostAddress serverAddress() const;
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index 2027481..cab6da6 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -1,34 +1,34 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = 802_11_user.h \ 4HEADERS = 802_11_user.h \
5 dhcp.h \ 5 dhcp.h \
6 udp_ports.h \ 6 udp_ports.h \
7 wireless.h \ 7 wireless.h \
8 odebugmapper.h \ 8 odebugmapper.h \
9 omanufacturerdb.h \ 9 omanufacturerdb.h \
10 onetutils.h \ 10 onetutils.h \
11 onetwork.h \ 11 onetwork.h \
12 opcap.h \ 12 opcap.h \
13 ostation.h 13 ostation.h
14SOURCES = odebugmapper.cpp \ 14SOURCES = odebugmapper.cpp \
15 omanufacturerdb.cpp \ 15 omanufacturerdb.cpp \
16 onetutils.cpp \ 16 onetutils.cpp \
17 onetwork.cpp \ 17 onetwork.cpp \
18 opcap.cpp \ 18 opcap.cpp \
19 ostation.cpp 19 ostation.cpp
20INTERFACES = 20INTERFACES =
21TARGET = opienet2 21TARGET = opienet2
22VERSION = 1.8.2 22VERSION = 1.8.3
23INCLUDEPATH += $(OPIEDIR)/include 23INCLUDEPATH += $(OPIEDIR)/include
24DEPENDPATH += $(OPIEDIR)/include 24DEPENDPATH += $(OPIEDIR)/include
25LIBS += -lpcap 25LIBS += -lpcap
26 26
27 27
28!contains( platform, x11 ) { 28!contains( platform, x11 ) {
29 include ( $(OPIEDIR)/include.pro ) 29 include ( $(OPIEDIR)/include.pro )
30} 30}
31 31
32contains( platform, x11 ) { 32contains( platform, x11 ) {
33 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 33 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
34} 34}