author | mickeyl <mickeyl> | 2004-01-08 17:21:28 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-08 17:21:28 (UTC) |
commit | 9634c11f8ea28af19a4afc6821c68cdc2b3e7c8a (patch) (unidiff) | |
tree | 20fd8d9b8c17bad10fb43abf7fb7bbde28ea2c8b | |
parent | de345d45e2336a67d837d342e6686266a25e9d58 (diff) | |
download | opie-9634c11f8ea28af19a4afc6821c68cdc2b3e7c8a.zip opie-9634c11f8ea28af19a4afc6821c68cdc2b3e7c8a.tar.gz opie-9634c11f8ea28af19a4afc6821c68cdc2b3e7c8a.tar.bz2 |
add parsing of ProbeRequests
-rw-r--r-- | libopie2/opienet/opcap.cpp | 8 |
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 | |||
@@ -679,98 +679,102 @@ int OWaveLanPacket::subType() const | |||
679 | 679 | ||
680 | int OWaveLanPacket::type() const | 680 | int 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 | ||
686 | int OWaveLanPacket::version() const | 686 | int 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 | ||
692 | bool OWaveLanPacket::fromDS() const | 692 | bool 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 | ||
698 | bool OWaveLanPacket::toDS() const | 698 | bool 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 | ||
704 | bool OWaveLanPacket::usesPowerManagement() const | 704 | bool 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 | ||
710 | bool OWaveLanPacket::usesWep() const | 710 | bool 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 | ||
720 | OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, const struct ieee_802_11_mgmt_header* data, OWaveLanPacket* parent ) | 720 | OWaveLanManagementPacket::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 | ||
748 | OWaveLanManagementPacket::~OWaveLanManagementPacket() | 752 | OWaveLanManagementPacket::~OWaveLanManagementPacket() |
749 | { | 753 | { |
750 | } | 754 | } |
751 | 755 | ||
752 | 756 | ||
753 | QString OWaveLanManagementPacket::managementType() const | 757 | QString 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 | ||
773 | int OWaveLanManagementPacket::beaconInterval() const | 777 | int OWaveLanManagementPacket::beaconInterval() const |
774 | { | 778 | { |
775 | return EXTRACT_LE_16BITS( &_body->beacon_interval ); | 779 | return EXTRACT_LE_16BITS( &_body->beacon_interval ); |
776 | } | 780 | } |