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
@@ -242,25 +242,25 @@ struct ieee_802_11_mgmt_header {
242 u_int8_t bssid[6]; 242 u_int8_t bssid[6];
243 u_int16_t seq_ctrl; 243 u_int16_t seq_ctrl;
244}; 244};
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];
252 u_int8_tmac3[6]; 252 u_int8_tmac3[6];
253 u_int16_tSeqCtl; 253 u_int16_tSeqCtl;
254 u_int8_tmac4[6]; 254 u_int8_tmac4[6];
255 // u_int16_tgapLen; 255 // u_int16_tgapLen;
256 // u_int8_tgap[8]; 256 // u_int8_tgap[8];
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];
264 u_int8_tmac3[6]; 264 u_int8_tmac3[6];
265 u_int16_tSeqCtl; 265 u_int16_tSeqCtl;
266 u_int8_tmac4[6]; 266 u_int8_tmac4[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
@@ -235,14 +235,14 @@ int OEthernetPacket::type() const
235 235
236OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObject* parent ) 236OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObject* parent )
237 :QObject( parent, "IP" ), _iphdr( data ) 237 :QObject( parent, "IP" ), _iphdr( data )
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 {
246 case IPPROTO_UDP: new OUDPPacket( end, (const struct udphdr*) (data+1), this ); break; 246 case IPPROTO_UDP: new OUDPPacket( end, (const struct udphdr*) (data+1), this ); break;
247 case IPPROTO_TCP: new OTCPPacket( end, (const struct tcphdr*) (data+1), this ); break; 247 case IPPROTO_TCP: new OTCPPacket( end, (const struct tcphdr*) (data+1), this ); break;
248 default: odebug << "OIPPacket::OIPPacket(): unknown IP protocol, type = " << protocol() << oendl; 248 default: odebug << "OIPPacket::OIPPacket(): unknown IP protocol, type = " << protocol() << oendl;
@@ -336,13 +336,13 @@ QString OARPPacket::type() const
336 case 2: return "REPLY"; 336 case 2: return "REPLY";
337 case 3: return "RREQUEST"; 337 case 3: return "RREQUEST";
338 case 4: return "RREPLY"; 338 case 4: return "RREPLY";
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
346 346
347QHostAddress OARPPacket::senderIPV4Address() const 347QHostAddress OARPPacket::senderIPV4Address() const
348{ 348{
@@ -490,13 +490,13 @@ QString ODHCPPacket::type() const
490 case 3: return "REQUEST"; 490 case 3: return "REQUEST";
491 case 4: return "DECLINE"; 491 case 4: return "DECLINE";
492 case 5: return "ACK"; 492 case 5: return "ACK";
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
500 500
501QHostAddress ODHCPPacket::clientAddress() const 501QHostAddress ODHCPPacket::clientAddress() const
502{ 502{
@@ -762,15 +762,13 @@ QString OWaveLanManagementPacket::managementType() const
762 case ST_PROBE_RESPONSE: return "ProbeResponse"; break; 762 case ST_PROBE_RESPONSE: return "ProbeResponse"; break;
763 case ST_BEACON: return "Beacon"; break; 763 case ST_BEACON: return "Beacon"; break;
764 case ST_ATIM: return "Atim"; break; 764 case ST_ATIM: return "Atim"; break;
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
774 772
775int OWaveLanManagementPacket::beaconInterval() const 773int OWaveLanManagementPacket::beaconInterval() const
776{ 774{
@@ -1008,28 +1006,44 @@ OLLCPacket::~OLLCPacket()
1008 *======================================================================================*/ 1006 *======================================================================================*/
1009 1007
1010OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const struct ieee_802_11_control_header* data, OWaveLanPacket* parent ) 1008OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const struct ieee_802_11_control_header* data, OWaveLanPacket* parent )
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
1018OWaveLanControlPacket::~OWaveLanControlPacket() 1016OWaveLanControlPacket::~OWaveLanControlPacket()
1019{ 1017{
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
1033 1047
1034OPacketCapturer::~OPacketCapturer() 1048OPacketCapturer::~OPacketCapturer()
1035{ 1049{
@@ -1106,13 +1120,13 @@ int OPacketCapturer::dataLink() const
1106 1120
1107 1121
1108void OPacketCapturer::dump( OPacket* p ) 1122void 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 );
1116} 1130}
1117 1131
1118 1132
@@ -1165,13 +1179,13 @@ OPacket* OPacketCapturer::next()
1165 p->dumpStructure( const_cast<QObjectList*>( p->children() ) ); 1179 p->dumpStructure( const_cast<QObjectList*>( p->children() ) );
1166 #endif 1180 #endif
1167 return p; 1181 return p;
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}
1175 1189
1176 1190
1177bool OPacketCapturer::open( const QString& name ) 1191bool OPacketCapturer::open( const QString& name )
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
@@ -394,12 +394,14 @@ class OWaveLanControlPacket : public QObject
394 Q_OBJECT 394 Q_OBJECT
395 395
396 public: 396 public:
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};
403 405
404/*====================================================================================== 406/*======================================================================================
405 * OLLCPacket - IEEE 802.2 Link Level Control 407 * OLLCPacket - IEEE 802.2 Link Level Control