summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-02-23 15:14:18 (UTC)
committer mickeyl <mickeyl>2003-02-23 15:14:18 (UTC)
commit9b7faae2ec12eeb9a056ca6093ac6e0840b11717 (patch) (side-by-side diff)
treefc4d9de4ee2fd5c502513ccf0fa592bfaaa87185
parent791c7512c530cb373726f9c01e26229cb8ca992a (diff)
downloadopie-9b7faae2ec12eeb9a056ca6093ac6e0840b11717.zip
opie-9b7faae2ec12eeb9a056ca6093ac6e0840b11717.tar.gz
opie-9b7faae2ec12eeb9a056ca6093ac6e0840b11717.tar.bz2
- revamped part of the gui
- configuration is now a seperate dialog - orinoco_hopper is no longer needed
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c118
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro15
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui4
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/gui.pro12
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp74
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h8
-rw-r--r--noncore/net/wellenreiter/gui/manufacturers.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp29
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h11
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp18
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.h3
-rw-r--r--noncore/net/wellenreiter/wellenreiter.pro2
13 files changed, 102 insertions, 196 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
@@ -1,110 +1,110 @@
<!DOCTYPE UI><UI>
<class>WellenreiterConfigBase</class>
<widget>
- <class>QWidget</class>
+ <class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>WellenreiterConfigBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>224</width>
+ <width>220</width>
<height>267</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Form1</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>1</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>1</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>Sniffer</string>
</property>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line9</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout7</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget row="0" column="0" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
<string>&lt;select&gt;</string>
</property>
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
@@ -1,47 +1,47 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "configwindow.h"
#include <qmap.h>
#include <qcombobox.h>
#include <qspinbox.h>
WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
- :WellenreiterConfigBase( parent, name, f )
+ :WellenreiterConfigBase( parent, name, true, f )
{
_devicetype[ "cisco" ] = 1;
_devicetype[ "wlan-ng" ] = 2;
_devicetype[ "hostap" ] = 3;
_devicetype[ "orinoco" ] = 4;
_devicetype[ "<manual>" ] = 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/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,36 +1,40 @@
+MOC_DIR = ./tmp
+OBJECTS_DIR = ./tmp
DESTDIR = $(OPIEDIR)/bin
TEMPLATE = app
CONFIG = qt warn_on debug
-#CONFIG = qt warn_on release
-HEADERS = mainwindow.h \
- wellenreiterbase.h \
+
+HEADERS = wellenreiterbase.h \
+ mainwindow.h \
wellenreiter.h \
scanlistitem.h \
scanlist.h \
logwindow.h \
hexwindow.h \
configwindow.h \
wlan.h \
cardconfig.h \
manufacturers.h
+
SOURCES = main.cpp \
mainwindow.cpp \
wellenreiterbase.cpp \
wellenreiter.cpp \
scanlistitem.cpp \
scanlist.cpp \
logwindow.cpp \
hexwindow.cpp \
configwindow.cpp \
wlan.cpp \
cardconfig.cpp \
- manufacturers.h
+ manufacturers.cpp
+
INCLUDEPATH += $(OPIEDIR)/include ../
DEPENDPATH += $(OPIEDIR)/include ../
LIBS += -lqpe -lopie -L. -lwellenreiter
INTERFACES = configbase.ui
TARGET = wellenreiter
include ( $(OPIEDIR)/include.pro )
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
@@ -1,92 +1,140 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
+#include "configwindow.h"
#include "mainwindow.h"
#include "wellenreiter.h"
+#include <qcombobox.h>
#include <qiconset.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qstatusbar.h>
#include <qtoolbutton.h>
#ifdef QWS
#include <qpe/resource.h>
#else
#include "resource.h"
#endif
WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
:QMainWindow( parent, name, f )
{
+ cw = new WellenreiterConfigWindow( this );
mw = new Wellenreiter( this );
+ mw->setConfigWindow( cw );
setCentralWidget( mw );
// setup icon sets
searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) );
settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) );
cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
// setup tool buttons
- 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 );
QToolButton* c = new QToolButton( 0 );
c->setAutoRaise( true );
c->setIconSet( *infoIconSet );
c->setEnabled( false );
QToolButton* d = new QToolButton( 0 );
d->setAutoRaise( true );
d->setIconSet( *settingsIconSet );
+ connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
// setup menu bar
QMenuBar* mb = menuBar();
- 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
};
+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()
{
delete searchIconSet;
delete infoIconSet;
delete settingsIconSet;
delete cancelIconSet;
};
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
@@ -1,43 +1,49 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
class Wellenreiter;
+class WellenreiterConfigWindow;
class QIconSet;
+class QToolButton;
class WellenreiterMainWindow: public QMainWindow
{
+ Q_OBJECT
public:
WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 );
~WellenreiterMainWindow();
protected:
Wellenreiter* mw;
+ WellenreiterConfigWindow* cw;
const QIconSet* searchIconSet;
const QIconSet* infoIconSet;
const QIconSet* settingsIconSet;
const QIconSet* cancelIconSet;
+ QToolButton* startStopButton;
+ public slots:
+ void showConfigure();
};
#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
@@ -1,60 +1,60 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "manufacturers.h"
// Qt
#include <qstring.h>
#include <qfile.h>
#include <qtextstream.h>
ManufacturerDB::ManufacturerDB( const QString& filename )
{
QFile file( filename );
bool hasFile = file.open( IO_ReadOnly );
if (!hasFile)
{
qDebug( "ManufacturerDB: D'oh! Manufacturer list '%s' not found!", (const char*) filename );
}
else
{
qDebug( "ManufacturerDB: reading manufacturer list from '%s'...", (const char*) filename );
QTextStream s( &file );
QString addr;
QString manu;
while (!s.atEnd())
{
s >> addr;
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 );
}
}
}
ManufacturerDB::~ManufacturerDB()
{
}
const QString& ManufacturerDB::lookup( const QString& macaddr ) const
{
return manufacturers[macaddr.upper().left(8)];
}
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
@@ -1,283 +1,274 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
***********************************************************************/
// Qt
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qsocketnotifier.h>
// Qtopia
#ifdef QWS
#include <qpe/qpeapplication.h>
#include <qpe/global.h>
#endif
// Opie
#ifdef QWS
#include <opie/odevice.h>
using namespace Opie;
#endif
// Standard
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <fcntl.h>
// Local
#include "wellenreiter.h"
#include "scanlist.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "configwindow.h"
#include "manufacturers.h"
#include <daemon/source/config.hh>
#include <libwellenreiter/source/wl_types.hh>
#include <libwellenreiter/source/wl_sock.hh>
#include <libwellenreiter/source/wl_proto.hh>
-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 )
{
//
// construct manufacturer database
//
QString manufile;
#ifdef QWS
manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
#else
manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" );
#endif
manufacturerdb = new ManufacturerDB( manufile );
logwindow->log( "(i) Wellenreiter has been started." );
//
// detect operating system
//
#ifdef QWS
QString sys;
sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
_system = ODevice::inst()->system();
logwindow->log( sys );
#endif
//
// setup socket for daemon communication, register socket notifier
//
// struct sockaddr_in sockaddr;
daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr );
if ( daemon_fd == -1 )
{
logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
}
else
{
int flags;
flags = fcntl( daemon_fd, F_GETFL, 0 );
fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK );
QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent );
connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) );
}
// setup GUI
-
- connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
- // button->setEnabled( false );
netview->setColumnWidthMode( 1, QListView::Manual );
if ( manufacturerdb )
netview->setManufacturerDB( manufacturerdb );
}
Wellenreiter::~Wellenreiter()
{
// no need to delete child widgets, Qt does it all for us
delete manufacturerdb;
}
+void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
+{
+ configwindow = cw;
+}
+
void Wellenreiter::handleMessage()
{
// FIXME: receive message and handle it
qDebug( "received message from daemon." );
/*char buffer[10000];
memset( &buffer, 0, sizeof( buffer ) );*/
char buffer[WL_SOCKBUF];
// int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) );
/*
struct sockaddr from;
socklen_t len;
int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len );
qDebug( "received %d from recv [%d bytes]", result, len );
*/
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
int ssid_len; Length of SSID
int channel; Channel
int wep; 1 = WEP enabled ; 0 = disabled
char mac[64]; MAC address of Accesspoint
char bssid[128]; BSSID of Accesspoint
} wl_network_t;
*/
qDebug( "Recv result: %d", ( result ) );
qDebug( "Sniffer sent: '%s'", (const char*) buffer );
hexwindow->log( (const char*) &buffer );
if ( command == NETFOUND ) /* new network found */
{
qDebug( "Sniffer said: new network found." );
wl_network_t n;
get_network_found( &n, (char*) &buffer );
qDebug( "Sniffer said: net_type is %d.", n.net_type );
qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac );
//n.bssid[n.ssid_len] = "\0";
QString type;
if ( n.net_type == 1 )
type = "managed";
else
type = "adhoc";
netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 );
}
else
{
qDebug( "unknown sniffer command." );
}
}
void Wellenreiter::dataReceived()
{
logwindow->log( "(d) Received data from daemon" );
handleMessage();
}
-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 )
{
daemonRunning = false;
logwindow->log( "(i) Daemon has been stopped." );
- button->setText( tr( "Start Scanning" ) );
setCaption( tr( "Wellenreiter/Opie" ) );
// Stop daemon - ugly for now... later better
system( "killall wellenreiterd" );
// get configuration from config window
const QString& interface = configwindow->interfaceName->currentText();
// reset the interface trying to get it into a usable state again
QString cmdline;
cmdline.sprintf( "iwpriv %s monitor 0; ifdown %s; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface );
system( cmdline );
// message the user
QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." );
}
else
{
// get configuration from config window
const QString& interface = configwindow->interfaceName->currentText();
const int cardtype = configwindow->daemonDeviceType();
const int interval = configwindow->daemonHopInterval();
if ( ( interface == "<select>" ) || ( cardtype == 0 ) )
{
- 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;
}
// start wellenreiterd
QString cmdline;
cmdline.sprintf( "wellenreiterd %s %d &", (const char*) interface, cardtype );
qDebug( "about to execute '%s' ...", (const char*) cmdline );
system( cmdline );
qDebug( "done!" );
logwindow->log( "(i) Daemon has been started." );
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
@@ -1,78 +1,79 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef WELLENREITER_H
#define WELLENREITER_H
#include "wellenreiterbase.h"
#ifdef QWS
#include <opie/odevice.h>
using namespace Opie;
#endif
// ugly... not here!
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <fcntl.h>
#include <daemon/source/config.hh>
#include <libwellenreiter/source/wl_types.hh>
#include <libwellenreiter/source/wl_sock.hh>
#include <libwellenreiter/source/wl_proto.hh>
-
class QTimerEvent;
class QPixmap;
class ManufacturerDB;
+class WellenreiterConfigWindow;
class Wellenreiter : public WellenreiterBase {
Q_OBJECT
public:
-
- Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ Wellenreiter( QWidget* parent = 0 );
~Wellenreiter();
-protected:
+ void setConfigWindow( WellenreiterConfigWindow* cw );
+ protected:
bool daemonRunning;
public slots:
- void buttonClicked();
void dataReceived();
+ void startStopClicked();
private:
int daemon_fd; // socket filedescriptor for udp communication socket
#ifdef QWS
OSystem _system; // Opie Operating System identifier
#endif
void handleMessage();
ManufacturerDB* manufacturerdb;
+ WellenreiterConfigWindow* configwindow;
struct sockaddr_in sockaddr;
//void readConfig();
//void writeConfig();
};
#endif
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
@@ -1,181 +1,173 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
***********************************************************************/
#include "wellenreiterbase.h"
#include <qheader.h>
#include <qlabel.h>
#include <qlistview.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include "logwindow.h"
#include "hexwindow.h"
-#include "configwindow.h"
#include "scanlist.h"
#ifdef QWS
#include <qpe/resource.h>
#include <opie/otabwidget.h>
#else
#include "resource.h"
#include <qtabwidget.h>
#endif
/*
* Constructs a WellenreiterBase which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
//ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) );
//ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) );
//ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) );
//ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) );
if ( !name )
setName( "WellenreiterBase" );
resize( 191, 294 );
- setCaption( tr( "Wellenreiter" ) );
+#ifdef QWS
+ setCaption( tr( "Wellenreiter/Opie" ) );
+#else
+ setCaption( tr( "Wellenreiter/X11" ) );
+#endif
WellenreiterBaseLayout = new QVBoxLayout( this );
WellenreiterBaseLayout->setSpacing( 2 );
WellenreiterBaseLayout->setMargin( 0 );
#ifdef QWS
TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
#else
TabWidget = new QTabWidget( this, "TabWidget" );
#endif
ap = new QWidget( TabWidget, "ap" );
apLayout = new QVBoxLayout( ap );
apLayout->setSpacing( 2 );
apLayout->setMargin( 2 );
//--------- 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->setSpacing( 6 );
aboutLayout->setMargin( 11 );
PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
PixmapLabel1_3_2->setLineWidth( 2 );
PixmapLabel1_3_2->setMargin( 0 );
PixmapLabel1_3_2->setMidLineWidth( 0 );
PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
PixmapLabel1_3_2->setScaledContents( TRUE );
PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
TextLabel1_4_2_font.setPointSize( 10 );
TextLabel1_4_2->setFont( TextLabel1_4_2_font );
TextLabel1_4_2->setText( tr( "<p align=center>\n"
"<hr>\n"
"Max Moser<br>\n"
"Martin J. Muench<br>\n"
"Michael Lauer<br><hr>\n"
"<b>www.remote-exploit.org</b>\n"
"</p>" ) );
TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
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
TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
- TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) );
TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
#else
TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
- TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) );
TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
#endif
WellenreiterBaseLayout->addWidget( TabWidget );
- WellenreiterBaseLayout->addWidget( button );
#ifdef QWS
TabWidget->setCurrentTab( tr( "Networks" ) );
#endif
}
/*
* Destroys the object and frees any allocated resources
*/
WellenreiterBase::~WellenreiterBase()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Main event handler. Reimplemented to handle application
* font changes
*/
bool WellenreiterBase::event( QEvent* ev )
{
bool ret = QWidget::event( ev );
if ( ev->type() == QEvent::ApplicationFontChange ) {
//QFont Log_2_font( Log_2->font() );
//Log_2_font.setFamily( "adobe-courier" );
//Log_2_font.setPointSize( 8 );
//Log_2->setFont( Log_2_font );
QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
TextLabel1_4_2_font.setPointSize( 10 );
TextLabel1_4_2->setFont( TextLabel1_4_2_font );
}
return ret;
}
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
@@ -1,75 +1,72 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef WELLENREITERBASE_H
#define WELLENREITERBASE_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QLabel;
class MScanListView;
class MScanListItem;
class QPushButton;
class MLogWindow;
class MHexWindow;
-class WellenreiterConfigWindow;
#ifdef QWS
class OTabWidget;
#else
class QTabWidget;
#endif
class WellenreiterBase : public QWidget
{
Q_OBJECT
public:
WellenreiterBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~WellenreiterBase();
#ifdef QWS
OTabWidget* TabWidget;
#else
QTabWidget* TabWidget;
#endif
QWidget* ap;
MScanListView* netview;
MLogWindow* logwindow;
MHexWindow* hexwindow;
- WellenreiterConfigWindow* configwindow;
QWidget* about;
QLabel* PixmapLabel1_3_2;
QLabel* TextLabel1_4_2;
- QPushButton* button;
protected:
QVBoxLayout* WellenreiterBaseLayout;
QVBoxLayout* apLayout;
QGridLayout* aboutLayout;
bool event( QEvent* );
QPixmap* ani1;
QPixmap* ani2;
QPixmap* ani3;
QPixmap* ani4;
};
#endif // WELLENREITERBASE_H
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,6 +1,6 @@
TEMPLATE = subdirs
-unix:SUBDIRS = libwellenreiter daemon gui contrib/orinoco_hopper
+unix:SUBDIRS = libwellenreiter daemon gui
include ( $(OPIEDIR)/include.pro )