From e8f0c623ff6a8822b84b9cc4ee3c1fb3b3016738 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Fri, 14 Feb 2003 23:28:10 +0000 Subject: - remove manual switch into monitor mode ==> wellenreiterd handles this now - remove manual start of channelswitcher ==> wellenreiterd handles this now - add device type configurations for cisco, wlan-ng, hostap and orinoco - minor bugfix to the start/stop logic --- (limited to 'noncore/net/wellenreiter') diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 8dcf513..7992e6b 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -11,7 +11,7 @@ 0 0 - 228 + 224 267 @@ -153,6 +153,10 @@ enabled true + + whatsThis + Choose the interface used for sniffing. + QCheckBox @@ -180,13 +184,25 @@ text - orinoco + cisco + + + + + text + wlan-ng text - prism + hostap + + + + + text + orinoco @@ -203,6 +219,10 @@ enabled true + + whatsThis + Choose the type of driver used for sniffing. + QCheckBox @@ -245,6 +265,10 @@ lineStep 100 + + whatsThis + Choose the channel hop interval. + QLabel diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 04e3457..515d9b2 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -14,10 +14,34 @@ **********************************************************************/ #include "configwindow.h" +#include +#include +#include WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, f ) { - + _devicetype[ "cisco" ] = 1; + _devicetype[ "wlan-ng" ] = 2; + _devicetype[ "hostap" ] = 3; + _devicetype[ "orinoco" ] = 4; + _devicetype[ "" ] = 5; }; +int WellenreiterConfigWindow::daemonDeviceType() +{ + QString name = deviceType->currentText(); + if ( _devicetype.contains( name ) ) + { + return _devicetype[name]; + } + else + { + return 0; + } +}; + +int WellenreiterConfigWindow::daemonHopInterval() +{ + return hopInterval->cleanText().toInt(); +} diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index c2db283..c627901 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h @@ -17,14 +17,19 @@ #define WELLENREITERCONFIGWINDOW_H #include "configbase.h" +#include class WellenreiterConfigWindow : public WellenreiterConfigBase { public: WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); - - + int daemonDeviceType(); + int daemonHopInterval(); + + protected: + QMap _devicetype; + }; #endif diff --git a/noncore/net/wellenreiter/gui/manufacturers.h b/noncore/net/wellenreiter/gui/manufacturers.h index 67afe21..75728b1 100644 --- a/noncore/net/wellenreiter/gui/manufacturers.h +++ b/noncore/net/wellenreiter/gui/manufacturers.h @@ -17,7 +17,6 @@ #define MANUFACTURERS_H #include -#include class ManufacturerDB { @@ -30,7 +29,7 @@ class ManufacturerDB private: QMap manufacturers; - + }; #endif diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4ee9a35..4c1c972 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -68,7 +68,7 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) // // construct manufacturer database // - + QString manufile; #ifdef QWS manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); @@ -89,7 +89,7 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) _system = ODevice::inst()->system(); logwindow->log( sys ); #endif - + // // setup socket for daemon communication, register socket notifier // @@ -114,7 +114,7 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); // button->setEnabled( false ); netview->setColumnWidthMode( 1, QListView::Manual ); - + if ( manufacturerdb ) netview->setManufacturerDB( manufacturerdb ); @@ -151,15 +151,15 @@ void Wellenreiter::handleMessage() */ int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); - + if ( result == -1 ) { qDebug( "Warning: %s", strerror( errno ) ); return; } - + int command = buffer[1] - 48; - + /* typedef struct { int net_type; 1 = Accesspoint ; 2 = Ad-Hoc @@ -208,7 +208,7 @@ typedef struct { void Wellenreiter::dataReceived() { logwindow->log( "(d) Received data from daemon" ); - handleMessage(); + handleMessage(); } void Wellenreiter::buttonClicked() @@ -226,88 +226,61 @@ void Wellenreiter::buttonClicked() if ( daemonRunning ) { daemonRunning = false; - + logwindow->log( "(i) Daemon has been stopped." ); button->setText( "Start Scanning" ); - + // Stop daemon - ugly for now... later better - - system( "killall orinoco_hopper" ); + system( "killall wellenreiterd" ); - + // get configuration from config window - + const QString& interface = configwindow->interfaceName->currentText(); const QString& cardtype = configwindow->deviceType->currentText(); - const QString& interval = configwindow->hopInterval->cleanText(); - + //const QString& interval = configwindow->hopInterval->cleanText(); + // reset the card trying to get into a usable state again - + QString cmdline; - cmdline.sprintf( "iwpriv %s monitor 1", (const char*) interface ); - system( cmdline ); - cmdline.sprintf( "iwpriv %s monitor 1 6", (const char*) interface ); - system( cmdline ); - cmdline.sprintf( "ifconfig %s -promisc", (const char*) interface ); + cmdline.sprintf( "cardctl eject; cardctl insert" ); system( cmdline ); cmdline.sprintf( "killall -14 dhcpcd" ); system( cmdline ); cmdline.sprintf( "killall -10 udhcpc" ); - + // message the user QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); } - + else - { - - logwindow->log( "(i) Daemon has been started." ); - daemonRunning = true; - button->setText( "Stop Scanning" ); - + { + // get configuration from config window - + const QString& interface = configwindow->interfaceName->currentText(); - const QString& cardtype = configwindow->deviceType->currentText(); - const QString& interval = configwindow->hopInterval->cleanText(); - - if ( ( interface == "" ) ) + const int cardtype = configwindow->daemonDeviceType(); + const int interval = configwindow->daemonHopInterval(); + + if ( ( interface == "