summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-06 20:21:25 (UTC)
committer mickeyl <mickeyl>2004-01-06 20:21:25 (UTC)
commit543c349726a63798491e85cf0dda89e79c6183d1 (patch) (side-by-side diff)
treea230464852b0a32f1113ac4753c1423676ce66bb
parent7a9f4e78be5e2b888568ba99b2b65505d2a50bf0 (diff)
downloadopie-543c349726a63798491e85cf0dda89e79c6183d1.zip
opie-543c349726a63798491e85cf0dda89e79c6183d1.tar.gz
opie-543c349726a63798491e85cf0dda89e79c6183d1.tar.bz2
start parsing 802.11 control frames
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/802_11_user.h4
-rw-r--r--libopie2/opienet/opcap.cpp38
-rw-r--r--libopie2/opienet/opcap.h2
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
@@ -245,7 +245,7 @@ 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];
u_int8_t mac2[6];
@@ -257,7 +257,7 @@ 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];
u_int8_t mac2[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
@@ -238,8 +238,8 @@ 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() )
{
@@ -339,7 +339,7 @@ QString OARPPacket::type() const
case 8: return "InREQUEST";
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>";
}
}
@@ -493,7 +493,7 @@ QString ODHCPPacket::type() const
case 6: return "NAK";
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>";
}
}
@@ -765,9 +765,7 @@ QString OWaveLanManagementPacket::managementType() const
case ST_DISASSOC: return "Disassociation"; break;
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";
}
}
@@ -1011,7 +1009,7 @@ OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const st
:QObject( parent, "802.11 Control" ), _header( data )
{
odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl;
- //TODO: Implement this
+ odebug << "Detected subtype is " << controlType() << oendl;
}
@@ -1020,13 +1018,29 @@ 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
*======================================================================================*/
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 )
{
}
@@ -1109,7 +1123,7 @@ 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;
}
pcap_dump( (u_char*) _pcd, &p->_hdr, p->_data );
@@ -1168,7 +1182,7 @@ 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
@@ -397,6 +397,8 @@ class OWaveLanControlPacket : public QObject
OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 );
virtual ~OWaveLanControlPacket();
+ QString controlType() const;
+
private:
const struct ieee_802_11_control_header* _header;
};