summaryrefslogtreecommitdiff
Unidiff
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 {
245 245
246 246
247struct ieee_802_11_data_header { 247struct ieee_802_11_data_header {
248 u_int16_tframe_control; 248 u_int16_tfc;
249 u_int16_tduration; 249 u_int16_tduration;
250 u_int8_tmac1[6]; 250 u_int8_tmac1[6];
251 u_int8_tmac2[6]; 251 u_int8_tmac2[6];
@@ -257,7 +257,7 @@ struct ieee_802_11_data_header {
257}; 257};
258 258
259struct ieee_802_11_control_header { 259struct ieee_802_11_control_header {
260 u_int16_tframe_control; 260 u_int16_tfc;
261 u_int16_tduration; 261 u_int16_tduration;
262 u_int8_tmac1[6]; 262 u_int8_tmac1[6];
263 u_int8_tmac2[6]; 263 u_int8_tmac2[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
238{ 238{
239 odebug << "OIPPacket::OIPPacket(): decoding IP header..." << oendl; 239 odebug << "OIPPacket::OIPPacket(): decoding IP header..." << oendl;
240 240
241 odebug << "FromAddress = " << fromIPAddress().toString(); 241 odebug << "FromAddress = " << fromIPAddress().toString() << oendl;
242 odebug << " toAddress = " << toIPAddress().toString(); 242 odebug << " toAddress = " << toIPAddress().toString() << oendl;
243 243
244 switch ( protocol() ) 244 switch ( protocol() )
245 { 245 {
@@ -339,7 +339,7 @@ QString OARPPacket::type() const
339 case 8: return "InREQUEST"; 339 case 8: return "InREQUEST";
340 case 9: return "InREPLY"; 340 case 9: return "InREPLY";
341 case 10: return "NAK"; 341 case 10: return "NAK";
342 default: qWarning( "OARPPacket::type(): invalid ARP type!" ); return "<unknown>"; 342 default: owarn << "OARPPacket::type(): invalid ARP type!" << oendl; return "<unknown>";
343 } 343 }
344} 344}
345 345
@@ -493,7 +493,7 @@ QString ODHCPPacket::type() const
493 case 6: return "NAK"; 493 case 6: return "NAK";
494 case 7: return "RELEASE"; 494 case 7: return "RELEASE";
495 case 8: return "INFORM"; 495 case 8: return "INFORM";
496 default: qWarning( "ODHCPPacket::type(): invalid DHCP type (%d) !", _dhcphdr->op ); return "<unknown>"; 496 default: owarn << "ODHCPPacket::type(): invalid DHCP type " << _dhcphdr->op << oendl; return "<unknown>";
497 } 497 }
498} 498}
499 499
@@ -765,9 +765,7 @@ QString OWaveLanManagementPacket::managementType() const
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: 768 default: owarn << "OWaveLanManagementPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl; return "Unknown";
769 qWarning( "OWaveLanManagementPacket::managementType(): unhandled subtype %d", FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) );
770 return "Unknown";
771 } 769 }
772} 770}
773 771
@@ -1011,7 +1009,7 @@ OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const st
1011 :QObject( parent, "802.11 Control" ), _header( data ) 1009 :QObject( parent, "802.11 Control" ), _header( data )
1012{ 1010{
1013 odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl; 1011 odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl;
1014 //TODO: Implement this 1012 odebug << "Detected subtype is " << controlType() << oendl;
1015} 1013}
1016 1014
1017 1015
@@ -1020,13 +1018,29 @@ OWaveLanControlPacket::~OWaveLanControlPacket()
1020} 1018}
1021 1019
1022 1020
1021QString OWaveLanControlPacket::controlType() const
1022{
1023 switch ( FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) )
1024 {
1025 case CTRL_PS_POLL: return "PowerSavePoll"; break;
1026 case CTRL_RTS: return "RequestToSend"; break;
1027 case CTRL_CTS: return "ClearToSend"; break;
1028 case CTRL_ACK: return "Acknowledge"; break;
1029 case CTRL_CF_END: return "ContentionFreeEnd"; break;
1030 case CTRL_END_ACK: return "AcknowledgeEnd"; break;
1031 default:
1032 owarn << "OWaveLanControlPacket::managementType(): unhandled subtype " << FC_SUBTYPE( EXTRACT_LE_16BITS( &_header->fc ) ) << oendl;
1033 return "Unknown";
1034 }
1035}
1036
1037
1023/*====================================================================================== 1038/*======================================================================================
1024 * OPacketCapturer 1039 * OPacketCapturer
1025 *======================================================================================*/ 1040 *======================================================================================*/
1026 1041
1027OPacketCapturer::OPacketCapturer( QObject* parent, const char* name ) 1042OPacketCapturer::OPacketCapturer( QObject* parent, const char* name )
1028 :QObject( parent, name ), _name( QString::null ), _open( false ), 1043 :QObject( parent, name ), _name( QString::null ), _open( false ), _pch( 0 ), _pcd( 0 ), _sn( 0 )
1029 _pch( 0 ), _pcd( 0 ), _sn( 0 )
1030{ 1044{
1031} 1045}
1032 1046
@@ -1109,7 +1123,7 @@ void OPacketCapturer::dump( OPacket* p )
1109{ 1123{
1110 if ( !_pcd ) 1124 if ( !_pcd )
1111 { 1125 {
1112 qWarning( "OPacketCapturer::dump() - cannot dump without open capture file!" ); 1126 owarn << "OPacketCapturer::dump() - cannot dump without open capture file!" << oendl;
1113 return; 1127 return;
1114 } 1128 }
1115 pcap_dump( (u_char*) _pcd, &p->_hdr, p->_data ); 1129 pcap_dump( (u_char*) _pcd, &p->_hdr, p->_data );
@@ -1168,7 +1182,7 @@ OPacket* OPacketCapturer::next()
1168 } 1182 }
1169 else 1183 else
1170 { 1184 {
1171 qWarning( "OPacketCapturer::next() - no packet received!" ); 1185 owarn << "OPacketCapturer::next() - no packet received!" << oendl;
1172 return 0; 1186 return 0;
1173 } 1187 }
1174} 1188}
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
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;
401
400 private: 402 private:
401 const struct ieee_802_11_control_header* _header; 403 const struct ieee_802_11_control_header* _header;
402}; 404};