summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/manufacturers.cpp4
-rw-r--r--noncore/net/wellenreiter/gui/manufacturers.h2
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp36
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h7
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp19
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.h8
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp27
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h19
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp18
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro2
10 files changed, 109 insertions, 33 deletions
diff --git a/noncore/net/wellenreiter/gui/manufacturers.cpp b/noncore/net/wellenreiter/gui/manufacturers.cpp
index d235989..dad2753 100644
--- a/noncore/net/wellenreiter/gui/manufacturers.cpp
+++ b/noncore/net/wellenreiter/gui/manufacturers.cpp
@@ -42,3 +42,5 @@ ManufacturerDB::ManufacturerDB( const QString& filename )
manu = s.readLine();
+ #ifdef DEBUG
qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu );
+ #endif
manufacturers.insert( addr, manu );
@@ -54,3 +56,3 @@ ManufacturerDB::~ManufacturerDB()
-QString ManufacturerDB::lookup( const QString& macaddr )
+const QString& ManufacturerDB::lookup( const QString& macaddr ) const
{
diff --git a/noncore/net/wellenreiter/gui/manufacturers.h b/noncore/net/wellenreiter/gui/manufacturers.h
index d69977a..67afe21 100644
--- a/noncore/net/wellenreiter/gui/manufacturers.h
+++ b/noncore/net/wellenreiter/gui/manufacturers.h
@@ -27,3 +27,3 @@ class ManufacturerDB
virtual ~ManufacturerDB();
- QString lookup( const QString& macaddr );
+ const QString& lookup( const QString& macaddr ) const;
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 6d032aa..ab19701 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -20,5 +20,27 @@
+#include "manufacturers.h"
+
MScanListView::MScanListView( QWidget* parent, const char* name )
- :QListView( parent, name )
+ :QListView( parent, name ), _manufacturerdb( 0 )
{
+
+ setFrameShape( QListView::StyledPanel );
+ setFrameShadow( QListView::Sunken );
+
+ addColumn( tr( "Net/Station" ) );
+ setColumnAlignment( 0, AlignLeft || AlignVCenter );
+ addColumn( tr( "B" ) );
+ setColumnAlignment( 1, AlignCenter );
+ addColumn( tr( "AP" ) );
+ setColumnAlignment( 2, AlignCenter );
+ addColumn( tr( "Chn" ) );
+ setColumnAlignment( 3, AlignCenter );
+ addColumn( tr( "W" ) );
+ setColumnAlignment( 4, AlignCenter );
+ addColumn( tr( "T" ) );
+ setColumnAlignment( 5, AlignCenter );
+ addColumn( tr( "Manufacturer" ) );
+ setColumnAlignment( 6, AlignCenter );
+ setRootIsDecorated( true );
+ setAllColumnsShowFocus( true );
};
@@ -29,2 +51,7 @@ MScanListView::~MScanListView()
+void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb )
+{
+ _manufacturerdb = manufacturerdb;
+}
+
void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
@@ -86,3 +113,6 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
// we have already seen this item, it's a dupe
+ #ifdef DEBUG
qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
+ #endif
+ item->receivedBeacon();
return;
@@ -104,3 +134,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
- new MScanListItem( network, type, "", macaddr, wep, channel, signal );
+ MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
+ if ( _manufacturerdb )
+ station->setManufacturer( _manufacturerdb->lookup( macaddr ) );
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 6fe6930..9a35a82 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -22,2 +22,4 @@ class QString;
+class ManufacturerDB;
+
class MScanListView: public QListView
@@ -30,4 +32,9 @@ class MScanListView: public QListView
+ void setManufacturerDB( ManufacturerDB* manufacturerdb );
+
public slots:
void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
+
+ private:
+ ManufacturerDB* _manufacturerdb;
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index f4b43a6..15aef0c 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -32,2 +32,3 @@ const int col_wep = 4;
const int col_traffic = 5;
+const int col_manuf = 6;
@@ -35,3 +36,5 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
bool wep, int channel, int signal )
- :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
+ :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
+ _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
+ _channel( channel ), _signal( signal ), _beacons( 0 )
{
@@ -79 +82,15 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
+void MScanListItem::setManufacturer( const QString& manufacturer )
+{
+ setText( col_manuf, manufacturer );
+}
+
+void MScanListItem::receivedBeacon()
+{
+ _beacons++;
+ #ifdef DEBUG
+ qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
+ #endif
+ setText( col_sig, QString::number( _beacons ) );
+}
+
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h
index 47a5a4e..c3c6255 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.h
+++ b/noncore/net/wellenreiter/gui/scanlistitem.h
@@ -59,6 +59,8 @@ class MScanListItem: public QListViewItem
int signal() { return _signal; };
- int received() { return _received; };
+ int beacons() { return _beacons; };
void setSignal( int signal ) { /* TODO */ };
- void incReceived() { _received++; };
+ void receivedBeacon();
+
+ void setManufacturer( const QString& manufacturer );
@@ -71,3 +73,3 @@ class MScanListItem: public QListViewItem
int _signal;
- int _received;
+ int _beacons;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 9068e3a..b22c5cc 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -26,2 +26,3 @@
#ifdef QWS
+#include <qpe/qpeapplication.h>
#include <qpe/global.h>
@@ -57,8 +58,9 @@ using namespace Opie;
+#include <daemon/source/config.hh>
+#include <libwellenreiter/source/wl_types.hh>
#include <libwellenreiter/source/wl_sock.hh>
#include <libwellenreiter/source/wl_proto.hh>
-#include <daemon/source/config.hh>
Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
- : WellenreiterBase( parent, name, fl ), daemonRunning( false )
+ : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 )
{
@@ -71,3 +73,3 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
#ifdef QWS
- manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) qApp.qpeDir() );
+ manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
#else
@@ -94,3 +96,4 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
- daemon_fd = wl_setupsock( GUIADDR, GUIPORT );
+ // struct sockaddr_in sockaddr;
+ daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr );
if ( daemon_fd == -1 )
@@ -113,2 +116,5 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
netview->setColumnWidthMode( 1, QListView::Manual );
+
+ if ( manufacturerdb )
+ netview->setManufacturerDB( manufacturerdb );
@@ -129,4 +135,6 @@ void Wellenreiter::handleMessage()
- char buffer[10000];
- memset( &buffer, 0, sizeof( buffer ) );
+ /*char buffer[10000];
+ memset( &buffer, 0, sizeof( buffer ) );*/
+
+ char buffer[WL_SOCKBUF];
@@ -134,2 +142,4 @@ void Wellenreiter::handleMessage()
+ /*
+
struct sockaddr from;
@@ -138,4 +148,7 @@ void Wellenreiter::handleMessage()
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 );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 9715983..0ddc72c 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -25,2 +25,18 @@ using namespace Opie;
+// 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;
@@ -53,2 +69,3 @@ private:
ManufacturerDB* manufacturerdb;
+ struct sockaddr_in sockaddr;
@@ -58,2 +75,4 @@ private:
+
+
#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index d6b9891..a93c684 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -74,19 +74,3 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
- netview = new MScanListView( ap );
- netview->addColumn( tr( "SSID" ) );
- netview->setColumnAlignment( 0, AlignLeft || AlignVCenter );
- netview->addColumn( tr( "Sig" ) );
- netview->setColumnAlignment( 1, AlignCenter );
- netview->addColumn( tr( "AP" ) );
- netview->setColumnAlignment( 2, AlignCenter );
- netview->addColumn( tr( "Chn" ) );
- netview->setColumnAlignment( 3, AlignCenter );
- netview->addColumn( tr( "W" ) );
- netview->setColumnAlignment( 4, AlignCenter );
- netview->addColumn( tr( "T" ) );
- netview->setColumnAlignment( 5, AlignCenter );
-
- netview->setFrameShape( QListView::StyledPanel );
- netview->setFrameShadow( QListView::Sunken );
- netview->setRootIsDecorated( TRUE );
+ netview = new MScanListView( ap );
apLayout->addWidget( netview );
diff --git a/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro b/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro
index 9cf717e..8a6ed36 100644
--- a/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro
+++ b/noncore/net/wellenreiter/libwellenreiter/libwellenreiter.pro
@@ -3,3 +3,3 @@ CONFIG = warn_on debug
VERSION = 0.2
-HEADERS = source/cardmode.hh source/wl_log.hh source/wl_proto.hh source/sniff.hh source/wl_sock.hh
+HEADERS = source/cardmode.hh source/wl_log.hh source/wl_proto.hh source/sniff.hh source/wl_sock.hh source/wl_types.hh
SOURCES = source/cardmode.cc source/wl_log.cc source/wl_proto.cc source/sniff.cc source/wl_sock.cc