summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-31 14:59:35 (UTC)
committer mickeyl <mickeyl>2002-12-31 14:59:35 (UTC)
commit76ec681931f01609969b92e75908418d9e8e92d5 (patch) (unidiff)
tree8230634998f17c66ebb4eb1acd82112cdb77c944
parent3f35e5918b5f508139e189d2428d01d6c2933a50 (diff)
downloadopie-76ec681931f01609969b92e75908418d9e8e92d5.zip
opie-76ec681931f01609969b92e75908418d9e8e92d5.tar.gz
opie-76ec681931f01609969b92e75908418d9e8e92d5.tar.bz2
- catch with latest changes in libwellenreiter
- GUI now identifies and displays device manufacturers - GUI now displays the number of received beacons for each device
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
@@ -1,58 +1,60 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "manufacturers.h" 16#include "manufacturers.h"
17 17
18// Qt 18// Qt
19#include <qstring.h> 19#include <qstring.h>
20#include <qfile.h> 20#include <qfile.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22 22
23ManufacturerDB::ManufacturerDB( const QString& filename ) 23ManufacturerDB::ManufacturerDB( const QString& filename )
24{ 24{
25 QFile file( filename ); 25 QFile file( filename );
26 bool hasFile = file.open( IO_ReadOnly ); 26 bool hasFile = file.open( IO_ReadOnly );
27 if (!hasFile) 27 if (!hasFile)
28 { 28 {
29 qDebug( "ManufacturerDB: D'oh! Manufacturer list '%s' not found!", (const char*) filename ); 29 qDebug( "ManufacturerDB: D'oh! Manufacturer list '%s' not found!", (const char*) filename );
30 } 30 }
31 else 31 else
32 { 32 {
33 qDebug( "ManufacturerDB: reading manufacturer list from '%s'...", (const char*) filename ); 33 qDebug( "ManufacturerDB: reading manufacturer list from '%s'...", (const char*) filename );
34 QTextStream s( &file ); 34 QTextStream s( &file );
35 QString addr; 35 QString addr;
36 QString manu; 36 QString manu;
37 37
38 while (!s.atEnd()) 38 while (!s.atEnd())
39 { 39 {
40 s >> addr; 40 s >> addr;
41 s.skipWhiteSpace(); 41 s.skipWhiteSpace();
42 manu = s.readLine(); 42 manu = s.readLine();
43 #ifdef DEBUG
43 qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu ); 44 qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu );
45 #endif
44 manufacturers.insert( addr, manu ); 46 manufacturers.insert( addr, manu );
45 47
46 } 48 }
47 } 49 }
48 50
49} 51}
50 52
51ManufacturerDB::~ManufacturerDB() 53ManufacturerDB::~ManufacturerDB()
52{ 54{
53} 55}
54 56
55QString ManufacturerDB::lookup( const QString& macaddr ) 57const QString& ManufacturerDB::lookup( const QString& macaddr ) const
56{ 58{
57 return manufacturers[macaddr.upper().left(8)]; 59 return manufacturers[macaddr.upper().left(8)];
58} 60}
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
@@ -1,37 +1,37 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef MANUFACTURERS_H 16#ifndef MANUFACTURERS_H
17#define MANUFACTURERS_H 17#define MANUFACTURERS_H
18 18
19#include <qmap.h> 19#include <qmap.h>
20#include <string.h> 20#include <string.h>
21 21
22class ManufacturerDB 22class ManufacturerDB
23{ 23{
24 public: 24 public:
25 25
26 ManufacturerDB( const QString& filename ); 26 ManufacturerDB( const QString& filename );
27 virtual ~ManufacturerDB(); 27 virtual ~ManufacturerDB();
28 QString lookup( const QString& macaddr ); 28 const QString& lookup( const QString& macaddr ) const;
29 29
30 private: 30 private:
31 31
32 QMap<QString, QString> manufacturers; 32 QMap<QString, QString> manufacturers;
33 33
34}; 34};
35 35
36#endif 36#endif
37 37
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
@@ -1,117 +1,149 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "scanlist.h" 16#include "scanlist.h"
17#include "scanlistitem.h" 17#include "scanlistitem.h"
18 18
19#include <assert.h> 19#include <assert.h>
20 20
21#include "manufacturers.h"
22
21MScanListView::MScanListView( QWidget* parent, const char* name ) 23MScanListView::MScanListView( QWidget* parent, const char* name )
22 :QListView( parent, name ) 24 :QListView( parent, name ), _manufacturerdb( 0 )
23{ 25{
26
27 setFrameShape( QListView::StyledPanel );
28 setFrameShadow( QListView::Sunken );
29
30 addColumn( tr( "Net/Station" ) );
31 setColumnAlignment( 0, AlignLeft || AlignVCenter );
32 addColumn( tr( "B" ) );
33 setColumnAlignment( 1, AlignCenter );
34 addColumn( tr( "AP" ) );
35 setColumnAlignment( 2, AlignCenter );
36 addColumn( tr( "Chn" ) );
37 setColumnAlignment( 3, AlignCenter );
38 addColumn( tr( "W" ) );
39 setColumnAlignment( 4, AlignCenter );
40 addColumn( tr( "T" ) );
41 setColumnAlignment( 5, AlignCenter );
42 addColumn( tr( "Manufacturer" ) );
43 setColumnAlignment( 6, AlignCenter );
44 setRootIsDecorated( true );
45 setAllColumnsShowFocus( true );
24}; 46};
25 47
26MScanListView::~MScanListView() 48MScanListView::~MScanListView()
27{ 49{
28}; 50};
29 51
52void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb )
53{
54 _manufacturerdb = manufacturerdb;
55}
56
30void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 57void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
31{ 58{
32 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) 59 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
33 60
34 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", 61 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]",
35 (const char*) type, 62 (const char*) type,
36 (const char*) essid, 63 (const char*) essid,
37 (const char*) macaddr, 64 (const char*) macaddr,
38 channel ); 65 channel );
39 66
40 // search, if we already have seen this net 67 // search, if we already have seen this net
41 68
42 QString s; 69 QString s;
43 MScanListItem* network; 70 MScanListItem* network;
44 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 71 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
45 72
46 while ( item && ( item->text( 0 ) != essid ) ) 73 while ( item && ( item->text( 0 ) != essid ) )
47 { 74 {
48 qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); 75 qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
49 item = static_cast<MScanListItem*> ( item->itemBelow() ); 76 item = static_cast<MScanListItem*> ( item->itemBelow() );
50 } 77 }
51 if ( item ) 78 if ( item )
52 { 79 {
53 // animate the item 80 // animate the item
54 81
55 /* 82 /*
56 83
57 const QPixmap* pixmap = item->pixmap( 0 ); 84 const QPixmap* pixmap = item->pixmap( 0 );
58 const QPixmap* nextpixmap = ani2; 85 const QPixmap* nextpixmap = ani2;
59 if ( pixmap == ani1 ) 86 if ( pixmap == ani1 )
60 nextpixmap = ani2; 87 nextpixmap = ani2;
61 else if ( pixmap == ani2 ) 88 else if ( pixmap == ani2 )
62 nextpixmap = ani3; 89 nextpixmap = ani3;
63 else if ( pixmap == ani3 ) 90 else if ( pixmap == ani3 )
64 nextpixmap = ani4; 91 nextpixmap = ani4;
65 else if ( pixmap == ani4 ) 92 else if ( pixmap == ani4 )
66 nextpixmap = ani1; 93 nextpixmap = ani1;
67 item->setPixmap( 0, *nextpixmap ); */ 94 item->setPixmap( 0, *nextpixmap ); */
68 95
69 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); 96 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap );
70 97
71 // we have already seen this net, check all childs if MAC exists 98 // we have already seen this net, check all childs if MAC exists
72 99
73 network = item; 100 network = item;
74 101
75 item = static_cast<MScanListItem*> ( item->firstChild() ); 102 item = static_cast<MScanListItem*> ( item->firstChild() );
76 assert( item ); // this shouldn't fail 103 assert( item ); // this shouldn't fail
77 104
78 while ( item && ( item->text( 2 ) != macaddr ) ) 105 while ( item && ( item->text( 2 ) != macaddr ) )
79 { 106 {
80 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); 107 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
81 item = static_cast<MScanListItem*> ( item->itemBelow() ); 108 item = static_cast<MScanListItem*> ( item->itemBelow() );
82 } 109 }
83 110
84 if ( item ) 111 if ( item )
85 { 112 {
86 // we have already seen this item, it's a dupe 113 // we have already seen this item, it's a dupe
114 #ifdef DEBUG
87 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 115 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
116 #endif
117 item->receivedBeacon();
88 return; 118 return;
89 } 119 }
90 } 120 }
91 else 121 else
92 { 122 {
93 s.sprintf( "(i) new network: '%s'", (const char*) essid ); 123 s.sprintf( "(i) new network: '%s'", (const char*) essid );
94 124
95 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); 125 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
96 } 126 }
97 127
98 128
99 // insert new station as child from network 129 // insert new station as child from network
100 130
101 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 131 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
102 132
103 qDebug( "inserting new station %s", (const char*) macaddr ); 133 qDebug( "inserting new station %s", (const char*) macaddr );
104 134
105 new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 135 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
136 if ( _manufacturerdb )
137 station->setManufacturer( _manufacturerdb->lookup( macaddr ) );
106 138
107 if ( type == "managed" ) 139 if ( type == "managed" )
108 { 140 {
109 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); 141 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
110 } 142 }
111 else 143 else
112 { 144 {
113 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); 145 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
114 } 146 }
115 147
116} 148}
117 149
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
@@ -1,37 +1,44 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef SCANLIST_H 16#ifndef SCANLIST_H
17#define SCANLIST_H 17#define SCANLIST_H
18 18
19#include <qlistview.h> 19#include <qlistview.h>
20 20
21class QString; 21class QString;
22 22
23class ManufacturerDB;
24
23class MScanListView: public QListView 25class MScanListView: public QListView
24{ 26{
25 Q_OBJECT 27 Q_OBJECT
26 28
27 public: 29 public:
28 MScanListView( QWidget* parent = 0, const char* name = 0 ); 30 MScanListView( QWidget* parent = 0, const char* name = 0 );
29 virtual ~MScanListView(); 31 virtual ~MScanListView();
30 32
33 void setManufacturerDB( ManufacturerDB* manufacturerdb );
34
31 public slots: 35 public slots:
32 void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 36 void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
37
38 private:
39 ManufacturerDB* _manufacturerdb;
33 40
34}; 41};
35 42
36#endif 43#endif
37 44
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
@@ -1,79 +1,96 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "scanlistitem.h" 16#include "scanlistitem.h"
17#include <assert.h> 17#include <assert.h>
18#include <qpixmap.h> 18#include <qpixmap.h>
19 19
20#ifdef QWS 20#ifdef QWS
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#else 22#else
23#include "resource.h" 23#include "resource.h"
24#endif 24#endif
25 25
26const int col_type = 0; 26const int col_type = 0;
27const int col_essid = 0; 27const int col_essid = 0;
28const int col_sig = 1; 28const int col_sig = 1;
29const int col_ap = 2; 29const int col_ap = 2;
30const int col_channel = 3; 30const int col_channel = 3;
31const int col_wep = 4; 31const int col_wep = 4;
32const int col_traffic = 5; 32const int col_traffic = 5;
33const int col_manuf = 6;
33 34
34MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 35MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
35 bool wep, int channel, int signal ) 36 bool wep, int channel, int signal )
36 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 37 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
38 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
39 _channel( channel ), _signal( signal ), _beacons( 0 )
37{ 40{
38 qDebug( "creating scanlist item" ); 41 qDebug( "creating scanlist item" );
39 decorateItem( type, essid, macaddr, wep, channel, signal ); 42 decorateItem( type, essid, macaddr, wep, channel, signal );
40} 43}
41 44
42MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, 45MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
43 bool wep, int channel, int signal ) 46 bool wep, int channel, int signal )
44 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 47 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
45{ 48{
46 qDebug( "creating scanlist item" ); 49 qDebug( "creating scanlist item" );
47 decorateItem( type, essid, macaddr, wep, channel, signal ); 50 decorateItem( type, essid, macaddr, wep, channel, signal );
48} 51}
49 52
50void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 53void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
51{ 54{
52 qDebug( "decorating scanlist item %s / %s / %s [%d]", 55 qDebug( "decorating scanlist item %s / %s / %s [%d]",
53 (const char*) type, 56 (const char*) type,
54 (const char*) essid, 57 (const char*) essid,
55 (const char*) macaddr, 58 (const char*) macaddr,
56 channel ); 59 channel );
57 60
58 // set icon for managed or adhoc mode 61 // set icon for managed or adhoc mode
59 QString name; 62 QString name;
60 name.sprintf( "wellenreiter/%s", (const char*) type ); 63 name.sprintf( "wellenreiter/%s", (const char*) type );
61 setPixmap( col_type, Resource::loadPixmap( name ) ); 64 setPixmap( col_type, Resource::loadPixmap( name ) );
62 65
63 // set icon for wep (wireless encryption protocol) 66 // set icon for wep (wireless encryption protocol)
64 if ( wep ) 67 if ( wep )
65 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap! 68 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap!
66 69
67 // set channel and signal text 70 // set channel and signal text
68 71
69 if ( signal != -1 ) 72 if ( signal != -1 )
70 setText( col_sig, QString::number( signal ) ); 73 setText( col_sig, QString::number( signal ) );
71 if ( channel != -1 ) 74 if ( channel != -1 )
72 setText( col_channel, QString::number( channel ) ); 75 setText( col_channel, QString::number( channel ) );
73 76
74 listView()->triggerUpdate(); 77 listView()->triggerUpdate();
75 78
76 this->type = type; 79 this->type = type;
77 80
78} 81}
79 82
83void MScanListItem::setManufacturer( const QString& manufacturer )
84{
85 setText( col_manuf, manufacturer );
86}
87
88void MScanListItem::receivedBeacon()
89{
90 _beacons++;
91 #ifdef DEBUG
92 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
93 #endif
94 setText( col_sig, QString::number( _beacons ) );
95}
96
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
@@ -1,77 +1,79 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef SCANLISTITEM_H 16#ifndef SCANLISTITEM_H
17#define SCANLISTITEM_H 17#define SCANLISTITEM_H
18 18
19#include <qlistview.h> 19#include <qlistview.h>
20 20
21class QString; 21class QString;
22 22
23class MScanListItem: public QListViewItem 23class MScanListItem: public QListViewItem
24{ 24{
25 public: 25 public:
26 26
27 MScanListItem::MScanListItem( QListView* parent, 27 MScanListItem::MScanListItem( QListView* parent,
28 QString type, 28 QString type,
29 QString essid, 29 QString essid,
30 QString macaddr, 30 QString macaddr,
31 bool wep, 31 bool wep,
32 int channel, 32 int channel,
33 int signal ); 33 int signal );
34 34
35 MScanListItem::MScanListItem( QListViewItem* parent, 35 MScanListItem::MScanListItem( QListViewItem* parent,
36 QString type, 36 QString type,
37 QString essid, 37 QString essid,
38 QString macaddr, 38 QString macaddr,
39 bool wep, 39 bool wep,
40 int channel, 40 int channel,
41 int signal ); 41 int signal );
42 42
43 43
44 protected: 44 protected:
45 45
46 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 46 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
47 47
48 public: 48 public:
49 49
50 QString type; 50 QString type;
51 51
52 public: 52 public:
53 53
54 //const QString& type() { return _type; }; 54 //const QString& type() { return _type; };
55 const QString& essid() { return _essid; }; 55 const QString& essid() { return _essid; };
56 const QString& macaddr() { return _macaddr; }; 56 const QString& macaddr() { return _macaddr; };
57 bool wep() { return _wep; }; 57 bool wep() { return _wep; };
58 int channel() { return _channel; }; 58 int channel() { return _channel; };
59 int signal() { return _signal; }; 59 int signal() { return _signal; };
60 int received() { return _received; }; 60 int beacons() { return _beacons; };
61 61
62 void setSignal( int signal ) { /* TODO */ }; 62 void setSignal( int signal ) { /* TODO */ };
63 void incReceived() { _received++; }; 63 void receivedBeacon();
64
65 void setManufacturer( const QString& manufacturer );
64 66
65 private: 67 private:
66 QString _type; 68 QString _type;
67 QString _essid; 69 QString _essid;
68 QString _macaddr; 70 QString _macaddr;
69 bool _wep; 71 bool _wep;
70 int _channel; 72 int _channel;
71 int _signal; 73 int _signal;
72 int _received; 74 int _beacons;
73 75
74}; 76};
75 77
76#endif 78#endif
77 79
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
@@ -1,284 +1,297 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16// Qt 16// Qt
17 17
18#include <qpushbutton.h> 18#include <qpushbutton.h>
19#include <qmessagebox.h> 19#include <qmessagebox.h>
20#include <qcombobox.h> 20#include <qcombobox.h>
21#include <qspinbox.h> 21#include <qspinbox.h>
22#include <qsocketnotifier.h> 22#include <qsocketnotifier.h>
23 23
24// Qtopia 24// Qtopia
25 25
26#ifdef QWS 26#ifdef QWS
27#include <qpe/qpeapplication.h>
27#include <qpe/global.h> 28#include <qpe/global.h>
28#endif 29#endif
29 30
30// Opie 31// Opie
31 32
32#ifdef QWS 33#ifdef QWS
33#include <opie/odevice.h> 34#include <opie/odevice.h>
34using namespace Opie; 35using namespace Opie;
35#endif 36#endif
36 37
37// Standard 38// Standard
38 39
39#include <assert.h> 40#include <assert.h>
40#include <errno.h> 41#include <errno.h>
41#include <unistd.h> 42#include <unistd.h>
42#include <string.h> 43#include <string.h>
43#include <sys/types.h> 44#include <sys/types.h>
44#include <sys/socket.h> 45#include <sys/socket.h>
45#include <stdlib.h> 46#include <stdlib.h>
46#include <fcntl.h> 47#include <fcntl.h>
47 48
48// Local 49// Local
49 50
50#include "wellenreiter.h" 51#include "wellenreiter.h"
51#include "scanlist.h" 52#include "scanlist.h"
52#include "logwindow.h" 53#include "logwindow.h"
53#include "hexwindow.h" 54#include "hexwindow.h"
54#include "configwindow.h" 55#include "configwindow.h"
55 56
56#include "manufacturers.h" 57#include "manufacturers.h"
57 58
59#include <daemon/source/config.hh>
60#include <libwellenreiter/source/wl_types.hh>
58#include <libwellenreiter/source/wl_sock.hh> 61#include <libwellenreiter/source/wl_sock.hh>
59#include <libwellenreiter/source/wl_proto.hh> 62#include <libwellenreiter/source/wl_proto.hh>
60#include <daemon/source/config.hh>
61 63
62Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) 64Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
63 : WellenreiterBase( parent, name, fl ), daemonRunning( false ) 65 : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 )
64{ 66{
65 67
66 // 68 //
67 // construct manufacturer database 69 // construct manufacturer database
68 // 70 //
69 71
70 QString manufile; 72 QString manufile;
71 #ifdef QWS 73 #ifdef QWS
72 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) qApp.qpeDir() ); 74 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
73 #else 75 #else
74 manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); 76 manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" );
75 #endif 77 #endif
76 manufacturerdb = new ManufacturerDB( manufile ); 78 manufacturerdb = new ManufacturerDB( manufile );
77 79
78 logwindow->log( "(i) Wellenreiter has been started." ); 80 logwindow->log( "(i) Wellenreiter has been started." );
79 81
80 // 82 //
81 // detect operating system 83 // detect operating system
82 // 84 //
83 85
84 #ifdef QWS 86 #ifdef QWS
85 QString sys; 87 QString sys;
86 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); 88 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
87 _system = ODevice::inst()->system(); 89 _system = ODevice::inst()->system();
88 logwindow->log( sys ); 90 logwindow->log( sys );
89 #endif 91 #endif
90 92
91 // 93 //
92 // setup socket for daemon communication, register socket notifier 94 // setup socket for daemon communication, register socket notifier
93 // 95 //
94 96
95 daemon_fd = wl_setupsock( GUIADDR, GUIPORT ); 97 // struct sockaddr_in sockaddr;
98 daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr );
96 if ( daemon_fd == -1 ) 99 if ( daemon_fd == -1 )
97 { 100 {
98 logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); 101 logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
99 } 102 }
100 else 103 else
101 { 104 {
102 int flags; 105 int flags;
103 flags = fcntl( daemon_fd, F_GETFL, 0 ); 106 flags = fcntl( daemon_fd, F_GETFL, 0 );
104 fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); 107 fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK );
105 QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent ); 108 QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent );
106 connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); 109 connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) );
107 } 110 }
108 111
109 // setup GUI 112 // setup GUI
110 113
111 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); 114 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
112 button->setEnabled( false ); 115 button->setEnabled( false );
113 netview->setColumnWidthMode( 1, QListView::Manual ); 116 netview->setColumnWidthMode( 1, QListView::Manual );
117
118 if ( manufacturerdb )
119 netview->setManufacturerDB( manufacturerdb );
114 120
115} 121}
116 122
117Wellenreiter::~Wellenreiter() 123Wellenreiter::~Wellenreiter()
118{ 124{
119 // no need to delete child widgets, Qt does it all for us 125 // no need to delete child widgets, Qt does it all for us
120 126
121 delete manufacturerdb; 127 delete manufacturerdb;
122} 128}
123 129
124void Wellenreiter::handleMessage() 130void Wellenreiter::handleMessage()
125{ 131{
126 // FIXME: receive message and handle it 132 // FIXME: receive message and handle it
127 133
128 qDebug( "received message from daemon." ); 134 qDebug( "received message from daemon." );
129 135
130 char buffer[10000]; 136 /*char buffer[10000];
131 memset( &buffer, 0, sizeof( buffer ) ); 137 memset( &buffer, 0, sizeof( buffer ) );*/
138
139 char buffer[WL_SOCKBUF];
132 140
133 // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); 141 // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) );
134 142
143 /*
144
135 struct sockaddr from; 145 struct sockaddr from;
136 socklen_t len; 146 socklen_t len;
137 147
138 int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); 148 int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len );
139
140 qDebug( "received %d from recv [%d bytes]", result, len ); 149 qDebug( "received %d from recv [%d bytes]", result, len );
150
151 */
152
153 int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF );
141 154
142 if ( result == -1 ) 155 if ( result == -1 )
143 { 156 {
144 qDebug( "Warning: %s", strerror( errno ) ); 157 qDebug( "Warning: %s", strerror( errno ) );
145 return; 158 return;
146 } 159 }
147 160
148 int command = buffer[1] - 48; 161 int command = buffer[1] - 48;
149 162
150/* 163/*
151typedef struct { 164typedef struct {
152 int net_type; 1 = Accesspoint ; 2 = Ad-Hoc 165 int net_type; 1 = Accesspoint ; 2 = Ad-Hoc
153 int ssid_len; Length of SSID 166 int ssid_len; Length of SSID
154 int channel; Channel 167 int channel; Channel
155 int wep; 1 = WEP enabled ; 0 = disabled 168 int wep; 1 = WEP enabled ; 0 = disabled
156 char mac[64]; MAC address of Accesspoint 169 char mac[64]; MAC address of Accesspoint
157 char bssid[128]; BSSID of Accesspoint 170 char bssid[128]; BSSID of Accesspoint
158} wl_network_t; 171} wl_network_t;
159*/ 172*/
160 173
161 qDebug( "Recv result: %d", ( result ) ); 174 qDebug( "Recv result: %d", ( result ) );
162 qDebug( "Sniffer sent: '%s'", (const char*) buffer ); 175 qDebug( "Sniffer sent: '%s'", (const char*) buffer );
163 hexwindow->log( (const char*) &buffer ); 176 hexwindow->log( (const char*) &buffer );
164 177
165 if ( command == NETFOUND ) /* new network found */ 178 if ( command == NETFOUND ) /* new network found */
166 { 179 {
167 qDebug( "Sniffer said: new network found." ); 180 qDebug( "Sniffer said: new network found." );
168 wl_network_t n; 181 wl_network_t n;
169 get_network_found( &n, (char*) &buffer ); 182 get_network_found( &n, (char*) &buffer );
170 183
171 qDebug( "Sniffer said: net_type is %d.", n.net_type ); 184 qDebug( "Sniffer said: net_type is %d.", n.net_type );
172 qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); 185 qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac );
173 186
174 //n.bssid[n.ssid_len] = "\0"; 187 //n.bssid[n.ssid_len] = "\0";
175 188
176 QString type; 189 QString type;
177 190
178 if ( n.net_type == 1 ) 191 if ( n.net_type == 1 )
179 type = "managed"; 192 type = "managed";
180 else 193 else
181 type = "adhoc"; 194 type = "adhoc";
182 195
183 netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); 196 netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 );
184 197
185 } 198 }
186 199
187 else 200 else
188 201
189 { 202 {
190 qDebug( "unknown sniffer command." ); 203 qDebug( "unknown sniffer command." );
191 } 204 }
192 205
193} 206}
194 207
195void Wellenreiter::dataReceived() 208void Wellenreiter::dataReceived()
196{ 209{
197 logwindow->log( "(d) Received data from daemon" ); 210 logwindow->log( "(d) Received data from daemon" );
198 handleMessage(); 211 handleMessage();
199} 212}
200 213
201void Wellenreiter::buttonClicked() 214void Wellenreiter::buttonClicked()
202{ 215{
203 /* 216 /*
204 // add some test stations, so that we can see if the GUI part works 217 // add some test stations, so that we can see if the GUI part works
205 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); 218 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 );
206 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); 219 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 );
207 addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); 220 addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 );
208 addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); 221 addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
209 addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); 222 addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
210 */ 223 */
211 224
212 225
213 if ( daemonRunning ) 226 if ( daemonRunning )
214 { 227 {
215 daemonRunning = false; 228 daemonRunning = false;
216 229
217 logwindow->log( "(i) Daemon has been stopped." ); 230 logwindow->log( "(i) Daemon has been stopped." );
218 button->setText( "Start Scanning" ); 231 button->setText( "Start Scanning" );
219 232
220 // Stop daemon - ugly for now... later better 233 // Stop daemon - ugly for now... later better
221 234
222 system( "killall orinoco_hopper" ); 235 system( "killall orinoco_hopper" );
223 system( "killall wellenreiterd" ); 236 system( "killall wellenreiterd" );
224 237
225 // FIXME: reset the card trying to get into a usable state again 238 // FIXME: reset the card trying to get into a usable state again
226 239
227 // for now, just message the user 240 // for now, just message the user
228 241
229 QMessageBox::information( this, "Wellenreiter/Opie", "You should reset your\ndevice before using it again." ); 242 QMessageBox::information( this, "Wellenreiter/Opie", "You should reset your\ndevice before using it again." );
230 } 243 }
231 244
232 else 245 else
233 { 246 {
234 247
235 logwindow->log( "(i) Daemon has been started." ); 248 logwindow->log( "(i) Daemon has been started." );
236 daemonRunning = true; 249 daemonRunning = true;
237 button->setText( "Stop Scanning" ); 250 button->setText( "Stop Scanning" );
238 251
239 // get configuration from config window 252 // get configuration from config window
240 253
241 const QString& interface = configwindow->interfaceName->currentText(); 254 const QString& interface = configwindow->interfaceName->currentText();
242 const QString& cardtype = configwindow->deviceType->currentText(); 255 const QString& cardtype = configwindow->deviceType->currentText();
243 const QString& interval = configwindow->hopInterval->cleanText(); 256 const QString& interval = configwindow->hopInterval->cleanText();
244 257
245 if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) 258 if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) )
246 { 259 {
247 QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); 260 QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." );
248 return; 261 return;
249 } 262 }
250 263
251 // set interface into monitor mode 264 // set interface into monitor mode
252 /* Global::Execute definitely does not work very well with non-gui stuff! :( */ 265 /* Global::Execute definitely does not work very well with non-gui stuff! :( */
253 266
254 QString cmdline; 267 QString cmdline;
255 268
256 cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); 269 cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface );
257 system( cmdline ); 270 system( cmdline );
258 cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); 271 cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface );
259 system( cmdline ); 272 system( cmdline );
260 273
261 // start channel hopper 274 // start channel hopper
262 275
263 cmdline = "orinoco_hopper "; 276 cmdline = "orinoco_hopper ";
264 cmdline += interface; 277 cmdline += interface;
265 cmdline += " -i "; 278 cmdline += " -i ";
266 cmdline += interval; 279 cmdline += interval;
267 cmdline += " &"; 280 cmdline += " &";
268 qDebug( "execute: %s", (const char*) cmdline ); 281 qDebug( "execute: %s", (const char*) cmdline );
269 system( cmdline ); 282 system( cmdline );
270 qDebug( "done" ); 283 qDebug( "done" );
271 284
272 // start daemon 285 // start daemon
273 286
274 cmdline = "wellenreiterd "; 287 cmdline = "wellenreiterd ";
275 cmdline += interface; 288 cmdline += interface;
276 cmdline += " 3"; 289 cmdline += " 3";
277 cmdline += " &"; 290 cmdline += " &";
278 291
279 qDebug( "execute: %s", (const char*) cmdline ); 292 qDebug( "execute: %s", (const char*) cmdline );
280 system( cmdline ); 293 system( cmdline );
281 qDebug( "done" ); 294 qDebug( "done" );
282 295
283 } 296 }
284} 297}
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
@@ -1,59 +1,78 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26// ugly... not here!
27
28#include <assert.h>
29#include <errno.h>
30#include <unistd.h>
31#include <string.h>
32#include <sys/types.h>
33#include <sys/socket.h>
34#include <stdlib.h>
35#include <fcntl.h>
36#include <daemon/source/config.hh>
37#include <libwellenreiter/source/wl_types.hh>
38#include <libwellenreiter/source/wl_sock.hh>
39#include <libwellenreiter/source/wl_proto.hh>
40
41
26class QTimerEvent; 42class QTimerEvent;
27class QPixmap; 43class QPixmap;
28class ManufacturerDB; 44class ManufacturerDB;
29 45
30class Wellenreiter : public WellenreiterBase { 46class Wellenreiter : public WellenreiterBase {
31 Q_OBJECT 47 Q_OBJECT
32 48
33public: 49public:
34 50
35 Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 51 Wellenreiter( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
36 ~Wellenreiter(); 52 ~Wellenreiter();
37 53
38protected: 54protected:
39 55
40 bool daemonRunning; 56 bool daemonRunning;
41 57
42public slots: 58public slots:
43 void buttonClicked(); 59 void buttonClicked();
44 void dataReceived(); 60 void dataReceived();
45 61
46private: 62private:
47 int daemon_fd; // socket filedescriptor for udp communication socket 63 int daemon_fd; // socket filedescriptor for udp communication socket
48 #ifdef QWS 64 #ifdef QWS
49 OSystem _system; // Opie Operating System identifier 65 OSystem _system; // Opie Operating System identifier
50 #endif 66 #endif
51 void handleMessage(); 67 void handleMessage();
52 68
53 ManufacturerDB* manufacturerdb; 69 ManufacturerDB* manufacturerdb;
70 struct sockaddr_in sockaddr;
54 71
55 //void readConfig(); 72 //void readConfig();
56 //void writeConfig(); 73 //void writeConfig();
57}; 74};
58 75
76
77
59#endif 78#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
@@ -1,197 +1,181 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16#include "wellenreiterbase.h" 16#include "wellenreiterbase.h"
17 17
18#include <qheader.h> 18#include <qheader.h>
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qlistview.h> 20#include <qlistview.h>
21#include <qmultilineedit.h> 21#include <qmultilineedit.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qvariant.h> 24#include <qvariant.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qimage.h> 27#include <qimage.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29 29
30#include "logwindow.h" 30#include "logwindow.h"
31#include "hexwindow.h" 31#include "hexwindow.h"
32#include "configwindow.h" 32#include "configwindow.h"
33#include "scanlist.h" 33#include "scanlist.h"
34 34
35#ifdef QWS 35#ifdef QWS
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <opie/otabwidget.h> 37#include <opie/otabwidget.h>
38#else 38#else
39#include "resource.h" 39#include "resource.h"
40#include <qtabwidget.h> 40#include <qtabwidget.h>
41#endif 41#endif
42 42
43 43
44/* 44/*
45 * Constructs a WellenreiterBase which is a child of 'parent', with the 45 * Constructs a WellenreiterBase which is a child of 'parent', with the
46 * name 'name' and widget flags set to 'f' 46 * name 'name' and widget flags set to 'f'
47 */ 47 */
48WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) 48WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
49 : QWidget( parent, name, fl ) 49 : QWidget( parent, name, fl )
50{ 50{
51 ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); 51 ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) );
52 ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); 52 ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) );
53 ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); 53 ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) );
54 ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); 54 ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) );
55 55
56 if ( !name ) 56 if ( !name )
57 setName( "WellenreiterBase" ); 57 setName( "WellenreiterBase" );
58 resize( 191, 294 ); 58 resize( 191, 294 );
59 setCaption( tr( "Wellenreiter" ) ); 59 setCaption( tr( "Wellenreiter" ) );
60 WellenreiterBaseLayout = new QVBoxLayout( this ); 60 WellenreiterBaseLayout = new QVBoxLayout( this );
61 WellenreiterBaseLayout->setSpacing( 2 ); 61 WellenreiterBaseLayout->setSpacing( 2 );
62 WellenreiterBaseLayout->setMargin( 0 ); 62 WellenreiterBaseLayout->setMargin( 0 );
63#ifdef QWS 63#ifdef QWS
64 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); 64 TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
65#else 65#else
66 TabWidget = new QTabWidget( this, "TabWidget" ); 66 TabWidget = new QTabWidget( this, "TabWidget" );
67#endif 67#endif
68 ap = new QWidget( TabWidget, "ap" ); 68 ap = new QWidget( TabWidget, "ap" );
69 apLayout = new QVBoxLayout( ap ); 69 apLayout = new QVBoxLayout( ap );
70 apLayout->setSpacing( 2 ); 70 apLayout->setSpacing( 2 );
71 apLayout->setMargin( 2 ); 71 apLayout->setMargin( 2 );
72 72
73 //--------- NETVIEW TAB -------------- 73 //--------- NETVIEW TAB --------------
74 74
75 netview = new MScanListView( ap ); 75 netview = new MScanListView( ap );
76 netview->addColumn( tr( "SSID" ) );
77 netview->setColumnAlignment( 0, AlignLeft || AlignVCenter );
78 netview->addColumn( tr( "Sig" ) );
79 netview->setColumnAlignment( 1, AlignCenter );
80 netview->addColumn( tr( "AP" ) );
81 netview->setColumnAlignment( 2, AlignCenter );
82 netview->addColumn( tr( "Chn" ) );
83 netview->setColumnAlignment( 3, AlignCenter );
84 netview->addColumn( tr( "W" ) );
85 netview->setColumnAlignment( 4, AlignCenter );
86 netview->addColumn( tr( "T" ) );
87 netview->setColumnAlignment( 5, AlignCenter );
88
89 netview->setFrameShape( QListView::StyledPanel );
90 netview->setFrameShadow( QListView::Sunken );
91 netview->setRootIsDecorated( TRUE );
92 apLayout->addWidget( netview ); 76 apLayout->addWidget( netview );
93 77
94 78
95 //--------- LOG TAB -------------- 79 //--------- LOG TAB --------------
96 80
97 logwindow = new MLogWindow( TabWidget, "Log" ); 81 logwindow = new MLogWindow( TabWidget, "Log" );
98 82
99 83
100 //--------- HEX TAB -------------- 84 //--------- HEX TAB --------------
101 85
102 hexwindow = new MHexWindow( TabWidget, "Hex" ); 86 hexwindow = new MHexWindow( TabWidget, "Hex" );
103 87
104 //--------- CONFIG TAB -------------- 88 //--------- CONFIG TAB --------------
105 89
106 configwindow = new WellenreiterConfigWindow( TabWidget, "Config" ); 90 configwindow = new WellenreiterConfigWindow( TabWidget, "Config" );
107 91
108 //--------- ABOUT TAB -------------- 92 //--------- ABOUT TAB --------------
109 93
110 about = new QWidget( TabWidget, "about" ); 94 about = new QWidget( TabWidget, "about" );
111 aboutLayout = new QGridLayout( about ); 95 aboutLayout = new QGridLayout( about );
112 aboutLayout->setSpacing( 6 ); 96 aboutLayout->setSpacing( 6 );
113 aboutLayout->setMargin( 11 ); 97 aboutLayout->setMargin( 11 );
114 98
115 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); 99 PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
116 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); 100 PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
117 PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); 101 PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
118 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); 102 PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
119 PixmapLabel1_3_2->setLineWidth( 2 ); 103 PixmapLabel1_3_2->setLineWidth( 2 );
120 PixmapLabel1_3_2->setMargin( 0 ); 104 PixmapLabel1_3_2->setMargin( 0 );
121 PixmapLabel1_3_2->setMidLineWidth( 0 ); 105 PixmapLabel1_3_2->setMidLineWidth( 0 );
122 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); 106 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
123 PixmapLabel1_3_2->setScaledContents( TRUE ); 107 PixmapLabel1_3_2->setScaledContents( TRUE );
124 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 108 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
125 109
126 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 110 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
127 111
128 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 112 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
129 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 113 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
130 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 114 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
131 TextLabel1_4_2_font.setPointSize( 10 ); 115 TextLabel1_4_2_font.setPointSize( 10 );
132 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 116 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
133 TextLabel1_4_2->setText( tr( "<p align=center>\n" 117 TextLabel1_4_2->setText( tr( "<p align=center>\n"
134"<hr>\n" 118"<hr>\n"
135"Max Moser<br>\n" 119"Max Moser<br>\n"
136"Martin J. Muench<br>\n" 120"Martin J. Muench<br>\n"
137"Michael Lauer<br><hr>\n" 121"Michael Lauer<br><hr>\n"
138"<b>www.remote-exploit.org</b>\n" 122"<b>www.remote-exploit.org</b>\n"
139"</p>" ) ); 123"</p>" ) );
140 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 124 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
141 125
142 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 126 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
143 127
144 button = new QPushButton( this, "button" ); 128 button = new QPushButton( this, "button" );
145 button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) ); 129 button->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, button->sizePolicy().hasHeightForWidth() ) );
146 button->setText( tr( "Start Scanning" ) ); 130 button->setText( tr( "Start Scanning" ) );
147 131
148#ifdef QWS 132#ifdef QWS
149 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) ); 133 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
150 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 134 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
151 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 135 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
152 TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) ); 136 TabWidget->addTab( configwindow, "wellenreiter/config", tr( "Config" ) );
153 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 137 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
154#else 138#else
155 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); 139 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
156 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); 140 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
157 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); 141 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
158 TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) ); 142 TabWidget->addTab( configwindow, /* "wellenreiter/config", */ tr( "Config" ) );
159 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); 143 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
160#endif 144#endif
161 WellenreiterBaseLayout->addWidget( TabWidget ); 145 WellenreiterBaseLayout->addWidget( TabWidget );
162 WellenreiterBaseLayout->addWidget( button ); 146 WellenreiterBaseLayout->addWidget( button );
163 147
164#ifdef QWS 148#ifdef QWS
165 TabWidget->setCurrentTab( tr( "Networks" ) ); 149 TabWidget->setCurrentTab( tr( "Networks" ) );
166#endif 150#endif
167 151
168} 152}
169 153
170/* 154/*
171 * Destroys the object and frees any allocated resources 155 * Destroys the object and frees any allocated resources
172 */ 156 */
173WellenreiterBase::~WellenreiterBase() 157WellenreiterBase::~WellenreiterBase()
174{ 158{
175 // no need to delete child widgets, Qt does it all for us 159 // no need to delete child widgets, Qt does it all for us
176} 160}
177 161
178/* 162/*
179 * Main event handler. Reimplemented to handle application 163 * Main event handler. Reimplemented to handle application
180 * font changes 164 * font changes
181 */ 165 */
182bool WellenreiterBase::event( QEvent* ev ) 166bool WellenreiterBase::event( QEvent* ev )
183{ 167{
184 bool ret = QWidget::event( ev ); 168 bool ret = QWidget::event( ev );
185 if ( ev->type() == QEvent::ApplicationFontChange ) { 169 if ( ev->type() == QEvent::ApplicationFontChange ) {
186 //QFont Log_2_font( Log_2->font() ); 170 //QFont Log_2_font( Log_2->font() );
187 //Log_2_font.setFamily( "adobe-courier" ); 171 //Log_2_font.setFamily( "adobe-courier" );
188 //Log_2_font.setPointSize( 8 ); 172 //Log_2_font.setPointSize( 8 );
189 //Log_2->setFont( Log_2_font ); 173 //Log_2->setFont( Log_2_font );
190 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 174 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
191 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 175 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
192 TextLabel1_4_2_font.setPointSize( 10 ); 176 TextLabel1_4_2_font.setPointSize( 10 );
193 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 177 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
194 } 178 }
195 return ret; 179 return ret;
196} 180}
197 181
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
@@ -1,11 +1,11 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = warn_on debug 2CONFIG = warn_on debug
3VERSION = 0.2 3VERSION = 0.2
4HEADERS = source/cardmode.hh source/wl_log.hh source/wl_proto.hh source/sniff.hh source/wl_sock.hh 4HEADERS = source/cardmode.hh source/wl_log.hh source/wl_proto.hh source/sniff.hh source/wl_sock.hh source/wl_types.hh
5SOURCES = source/cardmode.cc source/wl_log.cc source/wl_proto.cc source/sniff.cc source/wl_sock.cc 5SOURCES = source/cardmode.cc source/wl_log.cc source/wl_proto.cc source/sniff.cc source/wl_sock.cc
6 6
7LIBS = 7LIBS =
8TMAKE_CFLAGS += -D__UNIX__ 8TMAKE_CFLAGS += -D__UNIX__
9 9
10DESTDIR = $(QTDIR)/lib 10DESTDIR = $(QTDIR)/lib
11TARGET = wellenreiter 11TARGET = wellenreiter