-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 8525109..ef7ffcf 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -213,25 +213,25 @@ void WellenreiterMainWindow::updateToolButtonState() | |||
213 | menuBar()->setItemEnabled( startID, false ); | 213 | menuBar()->setItemEnabled( startID, false ); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | void WellenreiterMainWindow::changedSniffingState() | 218 | void WellenreiterMainWindow::changedSniffingState() |
219 | { | 219 | { |
220 | startButton->setEnabled( !mw->sniffing ); | 220 | startButton->setEnabled( !mw->sniffing ); |
221 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 221 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
222 | stopButton->setEnabled( mw->sniffing ); | 222 | stopButton->setEnabled( mw->sniffing ); |
223 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 223 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
224 | 224 | ||
225 | if ( !mw->sniffing ) | 225 | if ( !mw->sniffing && QFile::exists( mw->dumpname ) ) |
226 | { | 226 | { |
227 | menuBar()->setItemEnabled( uploadID, true ); | 227 | menuBar()->setItemEnabled( uploadID, true ); |
228 | uploadButton->setEnabled( true ); | 228 | uploadButton->setEnabled( true ); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | WellenreiterMainWindow::~WellenreiterMainWindow() | 233 | WellenreiterMainWindow::~WellenreiterMainWindow() |
234 | { | 234 | { |
235 | odebug << "Wellenreiter: bye." << oendl; | 235 | odebug << "Wellenreiter: bye." << oendl; |
236 | }; | 236 | }; |
237 | 237 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index fe8f22d..2f85790 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -104,24 +104,25 @@ Wellenreiter::~Wellenreiter() | |||
104 | void Wellenreiter::initialTimer() | 104 | void Wellenreiter::initialTimer() |
105 | { | 105 | { |
106 | odebug << "preloading manufacturer database..." << oendl; | 106 | odebug << "preloading manufacturer database..." << oendl; |
107 | OManufacturerDB::instance(); | 107 | OManufacturerDB::instance(); |
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | void Wellenreiter::signalHandler( int sig ) | 111 | void Wellenreiter::signalHandler( int sig ) |
112 | { | 112 | { |
113 | oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; | 113 | oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; |
114 | if ( Wellenreiter::instance->sniffing ) | 114 | if ( Wellenreiter::instance->sniffing ) |
115 | { | 115 | { |
116 | Wellenreiter::instance->pcap->closeDumpFile(); | ||
116 | Wellenreiter::instance->pcap->close(); | 117 | Wellenreiter::instance->pcap->close(); |
117 | Wellenreiter::instance->stopClicked(); | 118 | Wellenreiter::instance->stopClicked(); |
118 | } | 119 | } |
119 | oerr << "Phew. Seemed to work." << oendl; | 120 | oerr << "Phew. Seemed to work." << oendl; |
120 | ::exit( -1 ); | 121 | ::exit( -1 ); |
121 | } | 122 | } |
122 | 123 | ||
123 | 124 | ||
124 | void Wellenreiter::registerSignalHandler() | 125 | void Wellenreiter::registerSignalHandler() |
125 | { | 126 | { |
126 | Wellenreiter::instance = this; | 127 | Wellenreiter::instance = this; |
127 | struct sigaction action; | 128 | struct sigaction action; |
@@ -613,36 +614,35 @@ void Wellenreiter::startClicked() | |||
613 | } | 614 | } |
614 | 615 | ||
615 | // open pcap and start sniffing | 616 | // open pcap and start sniffing |
616 | 617 | ||
617 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? | 618 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? |
618 | { | 619 | { |
619 | dumpname = configwindow->captureFileName->text(); | 620 | dumpname = configwindow->captureFileName->text(); |
620 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | 621 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; |
621 | dumpname.append( '-' ); | 622 | dumpname.append( '-' ); |
622 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 623 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
623 | dumpname.append( ".wellenreiter" ); | 624 | dumpname.append( ".wellenreiter" ); |
624 | } | 625 | } |
625 | else // write it anyway ;) | ||
626 | { | ||
627 | dumpname = "/var/log/dump.wellenreiter"; | ||
628 | } | ||
629 | 626 | ||
630 | if ( cardtype != DEVTYPE_FILE ) | 627 | if ( cardtype != DEVTYPE_FILE ) |
631 | pcap->open( interface ); | 628 | pcap->open( interface ); |
632 | else | 629 | else |
633 | pcap->openCaptureFile( interface ); | 630 | pcap->openCaptureFile( interface ); |
634 | 631 | ||
635 | odebug << "Wellenreiter:: dumping to " << dumpname << "" << oendl; | 632 | if ( configwindow->writeCaptureFile->isChecked() ) |
633 | { | ||
634 | odebug << "Wellenreiter:: dumping to " << dumpname << oendl; | ||
636 | pcap->openDumpFile( dumpname ); | 635 | pcap->openDumpFile( dumpname ); |
636 | } | ||
637 | 637 | ||
638 | if ( !pcap->isOpen() ) | 638 | if ( !pcap->isOpen() ) |
639 | { | 639 | { |
640 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( | 640 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( |
641 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); | 641 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); |
642 | return; | 642 | return; |
643 | } | 643 | } |
644 | 644 | ||
645 | // set capturer to non-blocking mode | 645 | // set capturer to non-blocking mode |
646 | pcap->setBlocking( false ); | 646 | pcap->setBlocking( false ); |
647 | 647 | ||
648 | // start channel hopper | 648 | // start channel hopper |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 32e5690..f582a5f 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -46,24 +46,25 @@ class Wellenreiter : public WellenreiterBase { | |||
46 | public: | 46 | public: |
47 | Wellenreiter( QWidget* parent = 0 ); | 47 | Wellenreiter( QWidget* parent = 0 ); |
48 | ~Wellenreiter(); | 48 | ~Wellenreiter(); |
49 | 49 | ||
50 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 50 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
51 | MScanListView* netView() const { return netview; }; | 51 | MScanListView* netView() const { return netview; }; |
52 | MLogWindow* logWindow() const { return logwindow; }; | 52 | MLogWindow* logWindow() const { return logwindow; }; |
53 | PacketView* hexWindow() const { return hexwindow; }; | 53 | PacketView* hexWindow() const { return hexwindow; }; |
54 | bool isDaemonRunning() const { return sniffing; }; | 54 | bool isDaemonRunning() const { return sniffing; }; |
55 | QString captureFileName() const { return dumpname; }; | 55 | QString captureFileName() const { return dumpname; }; |
56 | 56 | ||
57 | public: | 57 | public: |
58 | QString dumpname; | ||
58 | bool sniffing; | 59 | bool sniffing; |
59 | static Wellenreiter* instance; | 60 | static Wellenreiter* instance; |
60 | static void signalHandler( int sig ); | 61 | static void signalHandler( int sig ); |
61 | 62 | ||
62 | protected: | 63 | protected: |
63 | virtual void timerEvent( QTimerEvent* ); | 64 | virtual void timerEvent( QTimerEvent* ); |
64 | 65 | ||
65 | public slots: | 66 | public slots: |
66 | void initialTimer(); | 67 | void initialTimer(); |
67 | 68 | ||
68 | void channelHopped(int); | 69 | void channelHopped(int); |
69 | void receivePacket(Opie::Net::OPacket*); | 70 | void receivePacket(Opie::Net::OPacket*); |
@@ -88,25 +89,24 @@ class Wellenreiter : public WellenreiterBase { | |||
88 | void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); | 89 | void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); |
89 | void handleNotification( Opie::Net::OPacket* p ); | 90 | void handleNotification( Opie::Net::OPacket* p ); |
90 | void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p ); | 91 | void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p ); |
91 | QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); | 92 | QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); |
92 | bool checkDumpPacket( Opie::Net::OPacket* p ); | 93 | bool checkDumpPacket( Opie::Net::OPacket* p ); |
93 | void registerSignalHandler(); | 94 | void registerSignalHandler(); |
94 | 95 | ||
95 | private: | 96 | private: |
96 | #ifdef QWS | 97 | #ifdef QWS |
97 | Opie::Core::OSystem _system; // Opie Operating System identifier | 98 | Opie::Core::OSystem _system; // Opie Operating System identifier |
98 | #endif | 99 | #endif |
99 | 100 | ||
100 | QString dumpname; | ||
101 | Opie::Net::OWirelessNetworkInterface* iface; | 101 | Opie::Net::OWirelessNetworkInterface* iface; |
102 | Opie::Net::OPacketCapturer* pcap; | 102 | Opie::Net::OPacketCapturer* pcap; |
103 | WellenreiterConfigWindow* configwindow; | 103 | WellenreiterConfigWindow* configwindow; |
104 | GPS* gps; | 104 | GPS* gps; |
105 | 105 | ||
106 | //void readConfig(); | 106 | //void readConfig(); |
107 | //void writeConfig(); | 107 | //void writeConfig(); |
108 | }; | 108 | }; |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | #endif | 112 | #endif |