summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp64
1 files changed, 55 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index edf7dcf..965f6b0 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -153,3 +153,3 @@ void Wellenreiter::handleNotification( OPacket* p )
153 QString action = configwindow->parsePackets->protocolAction( name ); 153 QString action = configwindow->parsePackets->protocolAction( name );
154 qDebug( "action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 154 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
155 doAction( action, name, p ); 155 doAction( action, name, p );
@@ -158,3 +158,3 @@ void Wellenreiter::handleNotification( OPacket* p )
158 { 158 {
159 qDebug( "protocol '%s' not checked.", (const char*) name ); 159 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
160 } 160 }
@@ -273,5 +273,43 @@ void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data )
273 273
274QObject* childIfToParse( OPacket* p, const QString& protocol ) 274QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
275{ 275{
276 //FIXME: Implement 276 if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
277 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
278 return 0;
279
280 return p->child( protocol );
281}
282
283
284bool Wellenreiter::checkDumpPacket( OPacket* p )
285{
286 // go through all child packets and see if one is inside the child hierarchy for p
287 // if so, do what the user requested (protocolAction), e.g. pass or discard
288 if ( !configwindow->writeCaptureFile->isOn() )
289 return false;
290
291 QObjectList* l = p->queryList();
292 QObjectListIt it( *l );
293 QObject* o;
294
295 while ( (o = it.current()) != 0 )
296 {
297 QString name = it.current()->name();
298 if ( configwindow->capturePackets->isProtocolChecked( name ) )
299 {
300 QString action = configwindow->capturePackets->protocolAction( name );
301 qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
302 if ( action == "Discard" )
303 {
304 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) );
305 return false;
306 }
307 }
308 else
309 {
310 qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name );
311 }
312 ++it;
313 }
314 return true;
277} 315}
@@ -283,6 +321,9 @@ void Wellenreiter::receivePacket( OPacket* p )
283 321
284 handleNotification( p ); 322 if ( checkDumpPacket( p ) )
323 {
324 pcap->dump( p );
325 }
285 326
286 // check if we received a beacon frame 327 // check if we received a beacon frame
287 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 328 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
288 if ( beacon && beacon->managementType() == "Beacon" ) 329 if ( beacon && beacon->managementType() == "Beacon" )
@@ -296,3 +337,3 @@ void Wellenreiter::receivePacket( OPacket* p )
296 // check for a data frame 337 // check for a data frame
297 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); 338 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
298 if ( data ) 339 if ( data )
@@ -301,2 +342,5 @@ void Wellenreiter::receivePacket( OPacket* p )
301 } 342 }
343
344 handleNotification( p );
345
302} 346}
@@ -396,3 +440,5 @@ void Wellenreiter::startClicked()
396 { 440 {
397 if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? 441 pcap->open( interface );
442
443 if ( configwindow->writeCaptureFile->isOn() )
398 { 444 {
@@ -402,3 +448,3 @@ void Wellenreiter::startClicked()
402 dumpname.append( ".wellenreiter" ); 448 dumpname.append( ".wellenreiter" );
403 pcap->open( interface, dumpname ); 449 pcap->openDumpFile( dumpname );
404 } 450 }