summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui307
-rw-r--r--noncore/net/wellenreiter/gui/gui.pro2
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp24
3 files changed, 325 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
new file mode 100644
index 0000000..8f38252
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -0,0 +1,307 @@
+<!DOCTYPE UI><UI>
+<class>Form1</class>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Form1</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>226</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Form1</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Sniffer Options</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="2" column="0" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>hopInterval</cstring>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string> ms</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>2000</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>100</number>
+ </property>
+ <property stdset="1">
+ <name>lineStep</name>
+ <number>100</number>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Hop Interval</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>&lt;select&gt;</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>eth0</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>eth1</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>wlan0</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>wlan1</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>wifi0</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>wifi1</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>interfaceName</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Interface Name</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>&lt;select&gt;</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>cisco</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>orinoco</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>prism</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>&lt;manual&gt;</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>deviceType</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Device Type</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox8</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Advanced Options</string>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>additionalInfo</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>11</x>
+ <y>19</y>
+ <width>147</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Gather Additional Info</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>activeScanning</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>11</x>
+ <y>44</y>
+ <width>175</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Active Scanning (caution!)</string>
+ </property>
+ </widget>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>GUI Options</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>groupNetworks</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Group Detected Networks</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>enableActivity</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable Activity Display</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+</UI>
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro
index 8f14bc1..a047433 100644
--- a/noncore/net/wellenreiter/gui/gui.pro
+++ b/noncore/net/wellenreiter/gui/gui.pro
@@ -1,11 +1,11 @@
DESTDIR = $(OPIEDIR)/bin
TEMPLATE = app
CONFIG = qt warn_on debug
#CONFIG = qt warn_on release
HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h
SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp
INCLUDEPATH += $(OPIEDIR)/include ../daemon
DEPENDPATH += $(OPIEDIR)/include ../daemon
LIBS += -lqpe -lopie -lwellenreiter
-INTERFACES = wellenreitertemplate.ui
+INTERFACES = configbase.ui
TARGET = wellenreiter
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 6d62fa8..3453d18 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,71 +1,73 @@
/**********************************************************************
** 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>
// Standard
#include <assert.h>
+#include <errno.h>
#include <unistd.h>
+#include <string.h>
#include <sys/types.h>
// Local
#include "wellenreiter.h"
#include "scanlistitem.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS!
#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS!
#include "../daemon/source/config.hh" // <--- ugly path, FIX THIS!
Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
: WellenreiterBase( parent, name, fl )
{
logwindow->log( "(i) Wellenreiter has been started." );
connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
netview->setColumnWidthMode( 1, QListView::Manual );
//
// setup socket for daemon communication and start poller
//
daemon_fd = commsock( GUIADDR, GUIPORT );
if ( daemon_fd == -1 )
{
logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." );
}
else
startTimer( 700 );
}
Wellenreiter::~Wellenreiter()
{
// no need to delete child widgets, Qt does it all for us
}
void Wellenreiter::handleMessage()
{
// FIXME: receive message and handle it
qDebug( "received message from daemon." );
@@ -86,113 +88,121 @@ typedef struct {
*/
// qDebug( "Sniffer sent: '%s'", (const char*) buffer );
hexwindow->log( (const char*) &buffer );
if ( result == 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";
addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 );
}
else
{
qDebug( "unknown sniffer command." );
}
}
bool Wellenreiter::hasMessage()
{
// FIXME: do this in libwellenreiter, not here!!!
fd_set rfds;
FD_ZERO( &rfds );
FD_SET( daemon_fd, &rfds );
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 10;
int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv );
- return FD_ISSET( daemon_fd, &rfds );
+
+ if ( result == 0 )
+ {
+ return false;
+ }
+ else if ( result == -1 )
+ {
+ qDebug( "selected returned: %s", strerror( errno ) );
+ return false;
+ }
+ else
+ return true; //FD_ISSET( daemon_fd, &rfds ); gibbet 'eh nur einen Deskriptor
}
void Wellenreiter::timerEvent( QTimerEvent* e )
{
qDebug( "checking for message..." );
-
- int result = hasMessage();
- qDebug( "hasMessage() returned %d", result );
-
- if ( result )
+ if ( hasMessage() )
{
+ qDebug( "got message" );
handleMessage();
}
else
{
- qDebug( "no message :(" );
+ qDebug( "no message..." );
}
}
void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
// FIXME: this code belongs in customized QListView, not into this class
// FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]",
(const char*) type,
(const char*) essid,
(const char*) macaddr,
channel );
// search, if we already have seen this net
QString s;
MScanListItem* network;
MScanListItem* item = (MScanListItem*) netview->firstChild();
while ( item && ( item->text( 0 ) != essid ) )
{
qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
item = item->itemBelow();
}
if ( item )
{
// we have already seen this net, check all childs if MAC exists
network = item;
item = item->firstChild();
assert( item ); // this shouldn't fail
while ( item && ( item->text( 2 ) != macaddr ) )
{
qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
item = item->itemBelow();
}
if ( item )
{
// we have already seen this item, it's a dupe
qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
return;
}
}
else