summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index be2a86e..b4b6aa3 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -26,24 +26,25 @@ using namespace Opie;
26#include <qapplication.h> 26#include <qapplication.h>
27#endif 27#endif
28#include <opie2/onetwork.h> 28#include <opie2/onetwork.h>
29#include <opie2/opcap.h> 29#include <opie2/opcap.h>
30 30
31// Qt 31// Qt
32 32
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <qregexp.h>
38#include <qspinbox.h> 39#include <qspinbox.h>
39#include <qtoolbutton.h> 40#include <qtoolbutton.h>
40#include <qmainwindow.h> 41#include <qmainwindow.h>
41 42
42// Standard 43// Standard
43 44
44#include <assert.h> 45#include <assert.h>
45#include <errno.h> 46#include <errno.h>
46#include <unistd.h> 47#include <unistd.h>
47#include <string.h> 48#include <string.h>
48#include <sys/types.h> 49#include <sys/types.h>
49#include <stdlib.h> 50#include <stdlib.h>
@@ -316,25 +317,29 @@ void Wellenreiter::startClicked()
316 if ( !iface->monitorMode() ) 317 if ( !iface->monitorMode() )
317 { 318 {
318 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); 319 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
319 return; 320 return;
320 } 321 }
321 } 322 }
322 323
323 // open pcap and start sniffing 324 // open pcap and start sniffing
324 if ( cardtype != DEVTYPE_FILE ) 325 if ( cardtype != DEVTYPE_FILE )
325 { 326 {
326 if ( configwindow->writeCaptureFile->isEnabled() ) 327 if ( configwindow->writeCaptureFile->isEnabled() )
327 { 328 {
328 pcap->open( interface, configwindow->captureFileName->text() ); 329 QString dumpname( configwindow->captureFileName->text() );
330 dumpname.append( '-' );
331 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
332 dumpname.append( ".wellenreiter" );
333 pcap->open( interface, dumpname );
329 } 334 }
330 else 335 else
331 { 336 {
332 pcap->open( interface ); 337 pcap->open( interface );
333 } 338 }
334 } 339 }
335 else 340 else
336 { 341 {
337 pcap->open( QFile( interface ) ); 342 pcap->open( QFile( interface ) );
338 } 343 }
339 344
340 if ( !pcap->isOpen() ) 345 if ( !pcap->isOpen() )
@@ -356,23 +361,29 @@ void Wellenreiter::startClicked()
356 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 361 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
357 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 362 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
358 } 363 }
359 else 364 else
360 { 365 {
361 // start timer for reading packets 366 // start timer for reading packets
362 startTimer( 100 ); 367 startTimer( 100 );
363 } 368 }
364 369
365 logwindow->log( "(i) Started Scanning." ); 370 logwindow->log( "(i) Started Scanning." );
366 sniffing = true; 371 sniffing = true;
367 emit( startedSniffing() ); 372 emit( startedSniffing() );
373 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
374 else
375 {
376 assert( parent() );
377 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." );
378 }
368} 379}
369 380
370 381
371void Wellenreiter::timerEvent( QTimerEvent* ) 382void Wellenreiter::timerEvent( QTimerEvent* )
372{ 383{
373 qDebug( "Wellenreiter::timerEvent()" ); 384 qDebug( "Wellenreiter::timerEvent()" );
374 OPacket* p = pcap->next(); 385 OPacket* p = pcap->next();
375 receivePacket( p ); 386 receivePacket( p );
376 delete p; 387 delete p;
377} 388}
378 389