author | mickeyl <mickeyl> | 2004-01-06 20:21:25 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-06 20:21:25 (UTC) |
commit | 543c349726a63798491e85cf0dda89e79c6183d1 (patch) (side-by-side diff) | |
tree | a230464852b0a32f1113ac4753c1423676ce66bb /libopie2 | |
parent | 7a9f4e78be5e2b888568ba99b2b65505d2a50bf0 (diff) | |
download | opie-543c349726a63798491e85cf0dda89e79c6183d1.zip opie-543c349726a63798491e85cf0dda89e79c6183d1.tar.gz opie-543c349726a63798491e85cf0dda89e79c6183d1.tar.bz2 |
start parsing 802.11 control frames
-rw-r--r-- | libopie2/opienet/802_11_user.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 38 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 2 |
3 files changed, 30 insertions, 14 deletions
diff --git a/libopie2/opienet/802_11_user.h b/libopie2/opienet/802_11_user.h index ad84514..7ae27c5 100644 --- a/libopie2/opienet/802_11_user.h +++ b/libopie2/opienet/802_11_user.h @@ -246,5 +246,5 @@ struct ieee_802_11_mgmt_header { struct ieee_802_11_data_header { - u_int16_t frame_control; + u_int16_t fc; u_int16_t duration; u_int8_t mac1[6]; @@ -258,5 +258,5 @@ struct ieee_802_11_data_header { struct ieee_802_11_control_header { - u_int16_t frame_control; + u_int16_t fc; u_int16_t duration; u_int8_t mac1[6]; diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index e9b3b2c..012c0a3 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -239,6 +239,6 @@ OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObjec odebug << "OIPPacket::OIPPacket(): decoding IP header..." << oendl;
- odebug << "FromAddress = " << fromIPAddress().toString();
- odebug << " toAddress = " << toIPAddress().toString();
+ odebug << "FromAddress = " << fromIPAddress().toString() << oendl; + odebug << " toAddress = " << toIPAddress().toString() << oendl; switch ( protocol() )
@@ -340,5 +340,5 @@ QString OARPPacket::type() const case 9: return "InREPLY";
case 10: return "NAK";
- default: qWarning( "OARPPacket::type(): invalid ARP type!" ); return "<unknown>";
+ default: owarn << "OARPPacket::type(): invalid ARP type!" << oendl; return "<unknown>"; }
}
@@ -494,5 +494,5 @@ QString ODHCPPacket::type() const case 7: return "RELEASE";
case 8: return "INFORM";
- default: qWarning( "ODHCPPacket::type(): invalid DHCP type (%d) !", _dhcphdr->op ); return "<unknown>";
+ default: owarn << "ODHCPPacket::type(): invalid DHCP type " << _dhcphdr->op << oendl; return "<unknown>"; }
}
@@ -766,7 +766,5 @@ QString OWaveLanManagementPacket::managementType() const case ST_AUTH: return "Authentication"; break;
case ST_DEAUTH: return "Deathentication"; break;
- default:
- qWarning( "OWaveLanManagementPacket::managementType(): unhandled subtype %d", FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) );
- return "Unknown";
+ default: owarn << "OWaveLanManagementPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; return "Unknown"; }
}
@@ -1012,5 +1010,5 @@ OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const st {
odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl;
- //TODO: Implement this
+ odebug << "Detected subtype is " << controlType() << oendl; }
@@ -1021,4 +1019,21 @@ OWaveLanControlPacket::~OWaveLanControlPacket() +QString OWaveLanControlPacket::controlType() const +{ + switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) ) + { + case CTRL_PS_POLL: return "PowerSavePoll"; break; + case CTRL_RTS: return "RequestToSend"; break; + case CTRL_CTS: return "ClearToSend"; break; + case CTRL_ACK: return "Acknowledge"; break; + case CTRL_CF_END: return "ContentionFreeEnd"; break; + case CTRL_END_ACK: return "AcknowledgeEnd"; break; + default: + owarn << "OWaveLanControlPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; + return "Unknown"; + } +} + + /*======================================================================================
* OPacketCapturer
@@ -1026,6 +1041,5 @@ OWaveLanControlPacket::~OWaveLanControlPacket() OPacketCapturer::OPacketCapturer( QObject* parent, const char* name )
- :QObject( parent, name ), _name( QString::null ), _open( false ),
- _pch( 0 ), _pcd( 0 ), _sn( 0 )
+ :QObject( parent, name ), _name( QString::null ), _open( false ), _pch( 0 ), _pcd( 0 ), _sn( 0 ) {
}
@@ -1110,5 +1124,5 @@ void OPacketCapturer::dump( OPacket* p ) if ( !_pcd )
{
- qWarning( "OPacketCapturer::dump() - cannot dump without open capture file!" );
+ owarn << "OPacketCapturer::dump() - cannot dump without open capture file!" << oendl; return;
}
@@ -1169,5 +1183,5 @@ OPacket* OPacketCapturer::next() else
{
- qWarning( "OPacketCapturer::next() - no packet received!" );
+ owarn << "OPacketCapturer::next() - no packet received!" << oendl; return 0;
}
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index 497fd6b..b373c56 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h @@ -398,4 +398,6 @@ class OWaveLanControlPacket : public QObject virtual ~OWaveLanControlPacket(); + QString controlType() const; + private: const struct ieee_802_11_control_header* _header; |