summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter
authormickeyl <mickeyl>2003-04-09 10:37:19 (UTC)
committer mickeyl <mickeyl>2003-04-09 10:37:19 (UTC)
commit73f4014f0175c77b9bff8dd06f1c034eb80442f9 (patch) (unidiff)
treee402a7229190e3af5a090b7fdeadf43b78164061 /noncore/net/wellenreiter
parent5cb59a3e8abdbb05fe4bbc9e549f264153168232 (diff)
downloadopie-73f4014f0175c77b9bff8dd06f1c034eb80442f9.zip
opie-73f4014f0175c77b9bff8dd06f1c034eb80442f9.tar.gz
opie-73f4014f0175c77b9bff8dd06f1c034eb80442f9.tar.bz2
display a fancy ascii-animation in the titlebar while scanning...
... no really, it's actually pretty useful, because you can see which channel we are currently monitoring :-D
Diffstat (limited to 'noncore/net/wellenreiter') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp37
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h1
2 files changed, 30 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 8c2c315..0bfc8e9 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -31,13 +31,13 @@ using namespace Opie;
31// Qt 31// Qt
32 32
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qmessagebox.h> 34#include <qmessagebox.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qsocketnotifier.h> 37#include <qmainwindow.h>
38 38
39// Standard 39// Standard
40 40
41#include <assert.h> 41#include <assert.h>
42#include <errno.h> 42#include <errno.h>
43#include <unistd.h> 43#include <unistd.h>
@@ -92,25 +92,48 @@ Wellenreiter::Wellenreiter( QWidget* parent )
92 netview->setManufacturerDB( manufacturerdb ); 92 netview->setManufacturerDB( manufacturerdb );
93 93
94 pcap = new OPacketCapturer(); 94 pcap = new OPacketCapturer();
95 95
96} 96}
97 97
98
98Wellenreiter::~Wellenreiter() 99Wellenreiter::~Wellenreiter()
99{ 100{
100 // no need to delete child widgets, Qt does it all for us 101 // no need to delete child widgets, Qt does it all for us
101 102
102 delete manufacturerdb; 103 delete manufacturerdb;
103 delete pcap; 104 delete pcap;
104} 105}
105 106
107
106void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 108void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
107{ 109{
108 configwindow = cw; 110 configwindow = cw;
109} 111}
110 112
113
114void Wellenreiter::channelHopped(int c)
115{
116 QString title = "Wellenreiter II -scan- [";
117 QString left;
118 if ( c > 1 ) left.fill( '.', c-1 );
119 title.append( left );
120 title.append( '|' );
121 if ( c < iface->channels() )
122 {
123 QString right;
124 right.fill( '.', iface->channels()-c );
125 title.append( right );
126 }
127 title.append( "]" );
128 //title.append( QString().sprintf( " %02d", c ) );
129 assert( parent() );
130 ( (QMainWindow*) parent() )->setCaption( title );
131}
132
133
111void Wellenreiter::receivePacket(OPacket* p) 134void Wellenreiter::receivePacket(OPacket* p)
112{ 135{
113 hexWindow()->log( p->dump( 8 ) ); 136 hexWindow()->log( p->dump( 8 ) );
114 137
115 // check if we received a beacon frame 138 // check if we received a beacon frame
116 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 139 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
@@ -183,26 +206,26 @@ void Wellenreiter::receivePacket(OPacket* p)
183 else 206 else
184 { 207 {
185 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", 208 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'",
186 (const char*) wlan->macAddress2().toString(true), 209 (const char*) wlan->macAddress2().toString(true),
187 (const char*) wlan->macAddress1().toString(true), 210 (const char*) wlan->macAddress1().toString(true),
188 (const char*) wlan->macAddress3().toString(true) ); 211 (const char*) wlan->macAddress3().toString(true) );
189 netView()->traffic( "fromDS", wlan->macAddress2().toString(), 212 netView()->traffic( "IBSS", wlan->macAddress2().toString(),
190 wlan->macAddress1().toString(), 213 wlan->macAddress1().toString(),
191 wlan->macAddress3().toString() ); 214 wlan->macAddress3().toString() );
192 } 215 }
193 return; 216 return;
194 } 217 }
195} 218}
196 219
197void Wellenreiter::startStopClicked() 220void Wellenreiter::startStopClicked()
198{ 221{
199 if ( sniffing ) 222 if ( sniffing )
200 { 223 {
201 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 224 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
202 225 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
203 iface->setChannelHopping(); // stop hopping channels 226 iface->setChannelHopping(); // stop hopping channels
204 pcap->close(); 227 pcap->close();
205 sniffing = false; 228 sniffing = false;
206 #ifdef QWS 229 #ifdef QWS
207 oApp->setTitle(); 230 oApp->setTitle();
208 #else 231 #else
@@ -218,12 +241,14 @@ void Wellenreiter::startStopClicked()
218 iface->setMonitorMode( false ); 241 iface->setMonitorMode( false );
219 // switch off promisc flag 242 // switch off promisc flag
220 iface->setPromiscuousMode( false ); 243 iface->setPromiscuousMode( false );
221 244
222 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess 245 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
223 logwindow->log( "(i) Stopped Scanning." ); 246 logwindow->log( "(i) Stopped Scanning." );
247 assert( parent() );
248 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
224 249
225 // message the user 250 // message the user
226 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); 251 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
227 } 252 }
228 253
229 else 254 else
@@ -278,17 +303,13 @@ void Wellenreiter::startStopClicked()
278 303
279 // start channel hopper 304 // start channel hopper
280 iface->setChannelHopping( 1000 ); //use interval from config window 305 iface->setChannelHopping( 1000 ); //use interval from config window
281 306
282 // connect 307 // connect
283 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 308 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
309 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
284 310
285 logwindow->log( "(i) Started Scanning." ); 311 logwindow->log( "(i) Started Scanning." );
286 #ifdef QWS
287 oApp->setTitle( "Scanning ..." );
288 #else
289 qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." );
290 #endif
291 sniffing = true; 312 sniffing = true;
292 313
293 } 314 }
294} 315}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index ff73dd4..85f889b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -45,12 +45,13 @@ class Wellenreiter : public WellenreiterBase {
45 MScanListView* netView() const { return netview; }; 45 MScanListView* netView() const { return netview; };
46 MLogWindow* logWindow() const { return logwindow; }; 46 MLogWindow* logWindow() const { return logwindow; };
47 MHexWindow* hexWindow() const { return hexwindow; }; 47 MHexWindow* hexWindow() const { return hexwindow; };
48 bool isDaemonRunning() const { return sniffing; }; 48 bool isDaemonRunning() const { return sniffing; };
49 49
50 public slots: 50 public slots:
51 void channelHopped(int);
51 void receivePacket(OPacket*); 52 void receivePacket(OPacket*);
52 void startStopClicked(); 53 void startStopClicked();
53 54
54 private: 55 private:
55 #ifdef QWS 56 #ifdef QWS
56 OSystem _system; // Opie Operating System identifier 57 OSystem _system; // Opie Operating System identifier