summaryrefslogtreecommitdiff
path: root/libopie2/opienet
Unidiff
Diffstat (limited to 'libopie2/opienet') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 4d786f5..7463320 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -631,194 +631,198 @@ OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_
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 // Beacons contain a 12 byte long fixed parameters set before the tagged parameters come,
729 // Other management frames don't - which is why we have to inspect the subtype here.
730
731 const unsigned char* ptr = managementType() == "Beacon" ? (const unsigned char*) (_body+1) : (const unsigned char*) (_header+1);
732
729 while (ptr < end) 733 while (ptr < end)
730 { 734 {
731 switch ( *ptr ) 735 switch ( *ptr )
732 { 736 {
733 case E_SSID: new OWaveLanManagementSSID( end, (struct ssid_t*) ptr, this ); break; 737 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; 738 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; 739 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; 740 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; 741 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; 742 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; 743 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; 744 case E_CHALLENGE: new OWaveLanManagementChallenge( end, (struct challenge_t*) ptr, this ); break;
741 } 745 }
742 ptr+= ( ( struct ssid_t* ) ptr )->length; // skip length of tagged value 746 ptr+= ( ( struct ssid_t* ) ptr )->length; // skip length of tagged value
743 ptr+= 2; // skip tag ID and length 747 ptr+= 2; // skip tag ID and length
744 } 748 }
745} 749}
746 750
747 751
748OWaveLanManagementPacket::~OWaveLanManagementPacket() 752OWaveLanManagementPacket::~OWaveLanManagementPacket()
749{ 753{
750} 754}
751 755
752 756
753QString OWaveLanManagementPacket::managementType() const 757QString OWaveLanManagementPacket::managementType() const
754{ 758{
755 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) ) 759 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) )
756 { 760 {
757 case ST_ASSOC_REQUEST: return "AssociationRequest"; break; 761 case ST_ASSOC_REQUEST: return "AssociationRequest"; break;
758 case ST_ASSOC_RESPONSE: return "AssociationResponse"; break; 762 case ST_ASSOC_RESPONSE: return "AssociationResponse"; break;
759 case ST_REASSOC_REQUEST: return "ReassociationRequest"; break; 763 case ST_REASSOC_REQUEST: return "ReassociationRequest"; break;
760 case ST_REASSOC_RESPONSE: return "ReassociationResponse"; break; 764 case ST_REASSOC_RESPONSE: return "ReassociationResponse"; break;
761 case ST_PROBE_REQUEST: return "ProbeRequest"; break; 765 case ST_PROBE_REQUEST: return "ProbeRequest"; break;
762 case ST_PROBE_RESPONSE: return "ProbeResponse"; break; 766 case ST_PROBE_RESPONSE: return "ProbeResponse"; break;
763 case ST_BEACON: return "Beacon"; break; 767 case ST_BEACON: return "Beacon"; break;
764 case ST_ATIM: return "Atim"; break; 768 case ST_ATIM: return "Atim"; break;
765 case ST_DISASSOC: return "Disassociation"; break; 769 case ST_DISASSOC: return "Disassociation"; break;
766 case ST_AUTH: return "Authentication"; break; 770 case ST_AUTH: return "Authentication"; break;
767 case ST_DEAUTH: return "Deathentication"; break; 771 case ST_DEAUTH: return "Deathentication"; break;
768 default: owarn << "OWaveLanManagementPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; return "Unknown"; 772 default: owarn << "OWaveLanManagementPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; return "Unknown";
769 } 773 }
770} 774}
771 775
772 776
773int OWaveLanManagementPacket::beaconInterval() const 777int OWaveLanManagementPacket::beaconInterval() const
774{ 778{
775 return EXTRACT_LE_16BITS( &_body->beacon_interval ); 779 return EXTRACT_LE_16BITS( &_body->beacon_interval );
776} 780}
777 781
778 782
779int OWaveLanManagementPacket::capabilities() const 783int OWaveLanManagementPacket::capabilities() const
780{ 784{
781 return EXTRACT_LE_16BITS( &_body->capability_info ); 785 return EXTRACT_LE_16BITS( &_body->capability_info );
782} 786}
783 787
784 788
785bool OWaveLanManagementPacket::canESS() const 789bool OWaveLanManagementPacket::canESS() const
786{ 790{
787 return CAPABILITY_ESS( EXTRACT_LE_16BITS( &_body->capability_info ) ); 791 return CAPABILITY_ESS( EXTRACT_LE_16BITS( &_body->capability_info ) );
788} 792}
789 793
790 794
791bool OWaveLanManagementPacket::canIBSS() const 795bool OWaveLanManagementPacket::canIBSS() const
792{ 796{
793 return CAPABILITY_IBSS( EXTRACT_LE_16BITS( &_body->capability_info ) ); 797 return CAPABILITY_IBSS( EXTRACT_LE_16BITS( &_body->capability_info ) );
794} 798}
795 799
796 800
797bool OWaveLanManagementPacket::canCFP() const 801bool OWaveLanManagementPacket::canCFP() const
798{ 802{
799 return CAPABILITY_CFP( EXTRACT_LE_16BITS( &_body->capability_info ) ); 803 return CAPABILITY_CFP( EXTRACT_LE_16BITS( &_body->capability_info ) );
800} 804}
801 805
802 806
803bool OWaveLanManagementPacket::canCFP_REQ() const 807bool OWaveLanManagementPacket::canCFP_REQ() const
804{ 808{
805 return CAPABILITY_CFP_REQ( EXTRACT_LE_16BITS( &_body->capability_info ) ); 809 return CAPABILITY_CFP_REQ( EXTRACT_LE_16BITS( &_body->capability_info ) );
806} 810}
807 811
808 812
809bool OWaveLanManagementPacket::canPrivacy() const 813bool OWaveLanManagementPacket::canPrivacy() const
810{ 814{
811 return CAPABILITY_PRIVACY( EXTRACT_LE_16BITS( &_body->capability_info ) ); 815 return CAPABILITY_PRIVACY( EXTRACT_LE_16BITS( &_body->capability_info ) );
812} 816}
813 817
814 818
815/*====================================================================================== 819/*======================================================================================
816 * OWaveLanManagementSSID 820 * OWaveLanManagementSSID
817 *======================================================================================*/ 821 *======================================================================================*/
818 822
819OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const struct ssid_t* data, QObject* parent ) 823OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const struct ssid_t* data, QObject* parent )
820 :QObject( parent, "802.11 SSID" ), _data( data ) 824 :QObject( parent, "802.11 SSID" ), _data( data )
821{ 825{
822 odebug << "OWaveLanManagementSSID()" << oendl; 826 odebug << "OWaveLanManagementSSID()" << oendl;
823} 827}
824 828