-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c | 118 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro | 15 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 74 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/manufacturers.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 37 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 21 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 50 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.h | 13 | ||||
-rw-r--r-- | noncore/net/wellenreiter/wellenreiter.pro | 2 |
13 files changed, 135 insertions, 229 deletions
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c deleted file mode 100644 index 78f0299..0000000 --- a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c +++ b/dev/null @@ -1,118 +0,0 @@ -/* orinoco_hopper.c - * orinoco wireless nic channel scanning utility - * - * By Snax <snax@shmoo.com> - * Copyright (c) 2002 Snax - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a copy of the GNU General Public License write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> -#include <signal.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <linux/wireless.h> -#include <unistd.h> -#include <getopt.h> - -#ifndef SIOCIWFIRSTPRIV -#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE -#endif - -void changeChannel(int); -int setChannel( unsigned char channel ); - -int max = 11; -int mode = 2; -char dev[32]; - -void changeChannel(int x) { - static int chan = 0; - chan = (chan % max) + 1; - setChannel(chan); -} - -int setChannel( unsigned char channel ) -{ - int result = 0; - int fd; - struct iwreq ireq; //for Orinoco - int *ptr; - - /* get a socket */ - fd = socket(AF_INET, SOCK_STREAM, 0); - - if ( fd == -1 ) { - return -1; - } - ptr = (int *) ireq.u.name; - ptr[0] = mode; - ptr[1] = channel; - strcpy(ireq.ifr_ifrn.ifrn_name, dev); - result = ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq); - close(fd); - return result; -} - -void usage(char *cmd) { - fprintf(stderr, - "Usage: %s <iface> [-p] [-i <interval millisec>] [-n]\n -n = international channels\n -p = keep prism headers\n", cmd); - exit(1); -} - -int main (int argc, char *argv[]) -{ - struct itimerval tval; - int ms, r; - - //this will be the channel scanning interval, currently 0.2 sec - struct timeval interval = {0, 200000}; - - if (argc < 2) usage(argv[0]); - strncpy(dev, argv[1], 32); - dev[31] = 0; - - while (1) { - r = getopt(argc,argv,"i:np"); - if (r < 0) break; - switch (r) { - case 'n': - max = 14; - break; - case 'p': - mode = 1; - break; - case 'i': - ms = atoi(optarg); - interval.tv_sec = ms / 1000; - interval.tv_usec = (ms % 1000) * 1000; - break; - default: - usage(argv[0]); - } - } - - //this sets up the kchannel scanning stuff - signal(SIGALRM, changeChannel); - tval.it_interval = interval; - tval.it_value = interval; - setitimer(ITIMER_REAL, &tval, NULL); - while (1) pause(); - - return 0; -} - diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro deleted file mode 100644 index 30298d5..0000000 --- a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro +++ b/dev/null @@ -1,15 +0,0 @@ -DESTDIR = $(OPIEDIR)/bin -TEMPLATE = app -CONFIG = warn_on debug -#CONFIG = warn_on release -HEADERS = -SOURCES = orinoco_hopper.c -INCLUDEPATH += -DEPENDPATH += -LIBS += -INTERFACES = -TARGET = orinoco_hopper - - - -include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 7992e6b..398118f 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -3,3 +3,3 @@ <widget> - <class>QWidget</class> + <class>QDialog</class> <property stdset="1"> @@ -13,3 +13,3 @@ <y>0</y> - <width>224</width> + <width>220</width> <height>267</height> diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 515d9b2..6ea6f02 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -21,3 +21,3 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) - :WellenreiterConfigBase( parent, name, f ) + :WellenreiterConfigBase( parent, name, true, f ) { diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 4ee360d..95e9f22 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro @@ -1 +1,3 @@ +MOC_DIR = ./tmp +OBJECTS_DIR = ./tmp DESTDIR = $(OPIEDIR)/bin @@ -3,5 +5,5 @@ TEMPLATE = app CONFIG = qt warn_on debug -#CONFIG = qt warn_on release -HEADERS = mainwindow.h \ - wellenreiterbase.h \ + +HEADERS = wellenreiterbase.h \ + mainwindow.h \ wellenreiter.h \ @@ -15,2 +17,3 @@ HEADERS = mainwindow.h \ manufacturers.h + SOURCES = main.cpp \ @@ -26,3 +29,4 @@ SOURCES = main.cpp \ cardconfig.cpp \ - manufacturers.h + manufacturers.cpp + INCLUDEPATH += $(OPIEDIR)/include ../ diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index d7326c0..b67376c 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -15,2 +15,3 @@ +#include "configwindow.h" #include "mainwindow.h" @@ -18,2 +19,3 @@ +#include <qcombobox.h> #include <qiconset.h> @@ -33,3 +35,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n { + cw = new WellenreiterConfigWindow( this ); mw = new Wellenreiter( this ); + mw->setConfigWindow( cw ); setCentralWidget( mw ); @@ -45,7 +49,9 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n - QToolButton* b = new QToolButton( 0 ); - b->setAutoRaise( true ); - b->setOnIconSet( *cancelIconSet ); - b->setOffIconSet( *searchIconSet ); - b->setToggleButton( true ); + startStopButton = new QToolButton( 0 ); + startStopButton->setAutoRaise( true ); + startStopButton->setOnIconSet( *cancelIconSet ); + startStopButton->setOffIconSet( *searchIconSet ); + startStopButton->setToggleButton( true ); + connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); + startStopButton->setEnabled( false ); @@ -59,2 +65,3 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n d->setIconSet( *settingsIconSet ); + connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); @@ -64,14 +71,31 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n - QPopupMenu* p = new QPopupMenu( mb ); - p->insertItem( "&Load" ); - p->insertItem( "&Save" ); + QPopupMenu* file = new QPopupMenu( mb ); + file->insertItem( "&Load" ); + file->insertItem( "&Save" ); - mb->insertItem( "&File", p ); - mb->setItemEnabled( mb->insertItem( b ), false ); - mb->setItemEnabled( mb->insertItem( c ), false ); + QPopupMenu* view = new QPopupMenu( mb ); + view->insertItem( "&Configure" ); + + QPopupMenu* sniffer = new QPopupMenu( mb ); + sniffer->insertItem( "&Configure" ); + sniffer->insertSeparator(); + + int id; + + id = mb->insertItem( "&File", file ); + mb->setItemEnabled( id, false ); + id = mb->insertItem( "&View", view ); + mb->setItemEnabled( id, false ); + id = mb->insertItem( "&Sniffer", sniffer ); + mb->setItemEnabled( id, false ); + + mb->insertItem( startStopButton ); + mb->insertItem( c ); mb->insertItem( d ); - // setup status bar + // setup status bar (for now only on X11) - // statusBar()->message( "Ready." ); + #ifndef QWS + statusBar()->message( "Ready." ); + #endif @@ -79,2 +103,26 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n +void WellenreiterMainWindow::showConfigure() +{ + qDebug( "show configure..." ); + cw->setCaption( tr( "Configure" ) ); + cw->showMaximized(); + int result = cw->exec(); + + if ( result ) + { + // check configuration from config window + + const QString& interface = cw->interfaceName->currentText(); + const int cardtype = cw->daemonDeviceType(); + const int interval = cw->daemonHopInterval(); + + if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) + startStopButton->setEnabled( true ); + //TODO ... + else + startStopButton->setEnabled( false ); + //TODO ... + } +} + WellenreiterMainWindow::~WellenreiterMainWindow() diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index dcc79e6..7d772a8 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h @@ -21,3 +21,5 @@ class Wellenreiter; +class WellenreiterConfigWindow; class QIconSet; +class QToolButton; @@ -25,2 +27,3 @@ class WellenreiterMainWindow: public QMainWindow { + Q_OBJECT @@ -32,2 +35,3 @@ class WellenreiterMainWindow: public QMainWindow Wellenreiter* mw; + WellenreiterConfigWindow* cw; @@ -38,3 +42,6 @@ class WellenreiterMainWindow: public QMainWindow + QToolButton* startStopButton; + public slots: + void showConfigure(); }; @@ -42,2 +49 @@ class WellenreiterMainWindow: public QMainWindow #endif - diff --git a/noncore/net/wellenreiter/gui/manufacturers.cpp b/noncore/net/wellenreiter/gui/manufacturers.cpp index dad2753..f9f8967 100644 --- a/noncore/net/wellenreiter/gui/manufacturers.cpp +++ b/noncore/net/wellenreiter/gui/manufacturers.cpp @@ -36,3 +36,3 @@ ManufacturerDB::ManufacturerDB( const QString& filename ) QString manu; - + while (!s.atEnd()) @@ -40,9 +40,9 @@ ManufacturerDB::ManufacturerDB( const QString& filename ) s >> addr; - s.skipWhiteSpace(); + s.skipWhiteSpace(); manu = s.readLine(); #ifdef DEBUG - qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); + //qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); #endif manufacturers.insert( addr, manu ); - + } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4c53028..db7063b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -63,4 +63,5 @@ using namespace Opie; -Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) - : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) +Wellenreiter::Wellenreiter( QWidget* parent ) + : WellenreiterBase( parent, 0, 0 ), + daemonRunning( false ), manufacturerdb( 0 ), configwindow( 0 ) { @@ -80,3 +81,3 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) logwindow->log( "(i) Wellenreiter has been started." ); - + // @@ -84,3 +85,3 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) // - + #ifdef QWS @@ -112,5 +113,2 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) // setup GUI - - connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); - // button->setEnabled( false ); netview->setColumnWidthMode( 1, QListView::Manual ); @@ -119,3 +117,3 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) netview->setManufacturerDB( manufacturerdb ); - + } @@ -125,3 +123,3 @@ Wellenreiter::~Wellenreiter() // no need to delete child widgets, Qt does it all for us - + delete manufacturerdb; @@ -129,2 +127,7 @@ Wellenreiter::~Wellenreiter() +void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) +{ + configwindow = cw; +} + void Wellenreiter::handleMessage() @@ -213,14 +216,4 @@ void Wellenreiter::dataReceived() -void Wellenreiter::buttonClicked() +void Wellenreiter::startStopClicked() { - /* - // add some test stations, so that we can see if the GUI part works - addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); - addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); - addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); - addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); - addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); - */ - - if ( daemonRunning ) @@ -230,3 +223,2 @@ void Wellenreiter::buttonClicked() logwindow->log( "(i) Daemon has been stopped." ); - button->setText( tr( "Start Scanning" ) ); setCaption( tr( "Wellenreiter/Opie" ) ); @@ -263,3 +255,3 @@ void Wellenreiter::buttonClicked() { - QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); + QMessageBox::information( this, "Wellenreiter/Opie", "Your device is not\nptoperly configured. Please reconfigure!" ); return; @@ -278,3 +270,2 @@ void Wellenreiter::buttonClicked() daemonRunning = true; - button->setText( tr( "Stop Scanning" ) ); setCaption( tr( "Scanning ..." ) ); diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 0ddc72c..a55d6a1 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -40,3 +40,2 @@ using namespace Opie; - class QTimerEvent; @@ -44,2 +43,3 @@ class QPixmap; class ManufacturerDB; +class WellenreiterConfigWindow; @@ -48,16 +48,16 @@ class Wellenreiter : public WellenreiterBase { -public: - - Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + public: + Wellenreiter( QWidget* parent = 0 ); ~Wellenreiter(); -protected: - + void setConfigWindow( WellenreiterConfigWindow* cw ); + + protected: bool daemonRunning; -public slots: - void buttonClicked(); + public slots: void dataReceived(); + void startStopClicked(); -private: + private: int daemon_fd; // socket filedescriptor for udp communication socket @@ -69,4 +69,5 @@ private: ManufacturerDB* manufacturerdb; + WellenreiterConfigWindow* configwindow; struct sockaddr_in sockaddr; - + //void readConfig(); diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index da12f2b..3a703bc 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -31,3 +31,2 @@ #include "hexwindow.h" -#include "configwindow.h" #include "scanlist.h" @@ -57,5 +56,9 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f setName( "WellenreiterBase" ); - resize( 191, 294 ); - setCaption( tr( "Wellenreiter" ) ); - WellenreiterBaseLayout = new QVBoxLayout( this ); + resize( 191, 294 ); +#ifdef QWS + setCaption( tr( "Wellenreiter/Opie" ) ); +#else + setCaption( tr( "Wellenreiter/X11" ) ); +#endif + WellenreiterBaseLayout = new QVBoxLayout( this ); WellenreiterBaseLayout->setSpacing( 2 ); @@ -68,3 +71,3 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f ap = new QWidget( TabWidget, "ap" ); - apLayout = new QVBoxLayout( ap ); + apLayout = new QVBoxLayout( ap ); apLayout->setSpacing( 2 ); @@ -72,25 +75,21 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f - //--------- NETVIEW TAB -------------- - - netview = new MScanListView( ap ); + //--------- NETVIEW TAB -------------- + + netview = new MScanListView( ap ); apLayout->addWidget( netview ); - + //--------- LOG TAB -------------- - + logwindow = new MLogWindow( TabWidget, "Log" ); - + //--------- HEX TAB -------------- - + hexwindow = new MHexWindow( TabWidget, "Hex" ); - //--------- CONFIG TAB -------------- - - configwindow = new WellenreiterConfigWindow( TabWidget, "Config" ); - //--------- ABOUT TAB -------------- - + about = new QWidget( TabWidget, "about" ); - aboutLayout = new QGridLayout( about ); + aboutLayout = new QGridLayout( about ); aboutLayout->setSpacing( 6 ); @@ -115,3 +114,3 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TextLabel1_4_2_font.setPointSize( 10 ); - TextLabel1_4_2->setFont( TextLabel1_4_2_font ); + TextLabel1_4_2->setFont( TextLabel1_4_2_font ); TextLabel1_4_2->setText( tr( "<p align=center>\n" @@ -126,8 +125,4 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); - - button = new QPushButton( this, "button" ); - button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) ); - button->setText( tr( "Start Scanning" ) ); -#ifdef QWS +#ifdef QWS TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); @@ -135,3 +130,2 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); - TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) ); TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); @@ -141,9 +135,7 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); - TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) ); TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); -#endif +#endif WellenreiterBaseLayout->addWidget( TabWidget ); - WellenreiterBaseLayout->addWidget( button ); -#ifdef QWS +#ifdef QWS TabWidget->setCurrentTab( tr( "Networks" ) ); diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.h b/noncore/net/wellenreiter/gui/wellenreiterbase.h index edb2930..1fa1ea3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.h +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.h @@ -20,5 +20,5 @@ #include <qwidget.h> -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; class QLabel; @@ -29,3 +29,2 @@ class MLogWindow; class MHexWindow; -class WellenreiterConfigWindow; @@ -38,3 +37,3 @@ class QTabWidget; class WellenreiterBase : public QWidget -{ +{ Q_OBJECT @@ -54,3 +53,2 @@ public: MHexWindow* hexwindow; - WellenreiterConfigWindow* configwindow; QWidget* about; @@ -58,3 +56,2 @@ public: QLabel* TextLabel1_4_2; - QPushButton* button; @@ -65,3 +62,3 @@ protected: bool event( QEvent* ); - + QPixmap* ani1; diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro index 6784af4..dd75c8c 100644 --- a/noncore/net/wellenreiter/wellenreiter.pro +++ b/noncore/net/wellenreiter/wellenreiter.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -unix:SUBDIRS = libwellenreiter daemon gui contrib/orinoco_hopper +unix:SUBDIRS = libwellenreiter daemon gui |