summaryrefslogtreecommitdiff
path: root/noncore/net
authormickeyl <mickeyl>2005-05-10 17:27:42 (UTC)
committer mickeyl <mickeyl>2005-05-10 17:27:42 (UTC)
commit7ef3deff5f0023f0e73ad805b13cbd2b12bc1395 (patch) (unidiff)
tree17e209a557b79fd47a82301dae8982a3d16a4cdf /noncore/net
parente31f22952f47aeb54b206349f1e469704a6a6e8f (diff)
downloadopie-7ef3deff5f0023f0e73ad805b13cbd2b12bc1395.zip
opie-7ef3deff5f0023f0e73ad805b13cbd2b12bc1395.tar.gz
opie-7ef3deff5f0023f0e73ad805b13cbd2b12bc1395.tar.bz2
Remove joining networks from Wellenreiter. It never really fit into the
philosophy of this application and with OpieStumbler there is an application that does it better (active scan).
Diffstat (limited to 'noncore/net') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gui.pro2
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp11
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp39
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h2
-rw-r--r--noncore/net/wellenreiter/wellenreiter.pro2
6 files changed, 4 insertions, 53 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro
index faedd1b..544c2af 100644
--- a/noncore/net/wellenreiter/gui/gui.pro
+++ b/noncore/net/wellenreiter/gui/gui.pro
@@ -1,58 +1,58 @@
1DESTDIR = $(OPIEDIR)/bin 1DESTDIR = $(OPIEDIR)/bin
2TEMPLATE = app 2TEMPLATE = app
3CONFIG = qt warn_on 3CONFIG = qt warn_on
4 4
5HEADERS = wellenreiterbase.h \ 5HEADERS = wellenreiterbase.h \
6 mainwindow.h \ 6 mainwindow.h \
7 wellenreiter.h \ 7 wellenreiter.h \
8 scanlist.h \ 8 scanlist.h \
9 logwindow.h \ 9 logwindow.h \
10 hexwindow.h \ 10 hexwindow.h \
11 statwindow.h \ 11 statwindow.h \
12 configwindow.h \ 12 configwindow.h \
13 graphwindow.h \ 13 graphwindow.h \
14 packetview.h \ 14 packetview.h \
15 protolistview.h \ 15 protolistview.h \
16 gps.h 16 gps.h
17 17
18SOURCES = main.cpp \ 18SOURCES = main.cpp \
19 mainwindow.cpp \ 19 mainwindow.cpp \
20 wellenreiterbase.cpp \ 20 wellenreiterbase.cpp \
21 wellenreiter.cpp \ 21 wellenreiter.cpp \
22 scanlist.cpp \ 22 scanlist.cpp \
23 logwindow.cpp \ 23 logwindow.cpp \
24 hexwindow.cpp \ 24 hexwindow.cpp \
25 statwindow.cpp \ 25 statwindow.cpp \
26 configwindow.cpp \ 26 configwindow.cpp \
27 graphwindow.cpp \ 27 graphwindow.cpp \
28 packetview.cpp \ 28 packetview.cpp \
29 protolistview.cpp \ 29 protolistview.cpp \
30 gps.cpp 30 gps.cpp
31 31
32INCLUDEPATH += $(OPIEDIR)/include 32INCLUDEPATH += $(OPIEDIR)/include
33DEPENDPATH += $(OPIEDIR)/include 33DEPENDPATH += $(OPIEDIR)/include
34INTERFACES = configbase.ui 34INTERFACES = configbase.ui
35TARGET = wellenreiter 35TARGET = wellenreiter
36VERSION = 1.0.5 36VERSION = 1.0.6
37 37
38DEFINES += WELLENREITER_VERSION='"$$VERSION (GPL) Opie"' 38DEFINES += WELLENREITER_VERSION='"$$VERSION (GPL) Opie"'
39 39
40!contains( platform, x11 ) { 40!contains( platform, x11 ) {
41 message( qws ) 41 message( qws )
42 include( $(OPIEDIR)/include.pro ) 42 include( $(OPIEDIR)/include.pro )
43 LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2 43 LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2
44} 44}
45 45
46contains( platform, x11 ) { 46contains( platform, x11 ) {
47 LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter 47 LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter
48 SOURCES += resource.cpp 48 SOURCES += resource.cpp
49 HEADERS += resource.h 49 HEADERS += resource.h
50 DESTDIR = $(OPIEDIR)/output/bin 50 DESTDIR = $(OPIEDIR)/output/bin
51} 51}
52 52
53!isEmpty( LIBPCAP_INC_DIR ) { 53!isEmpty( LIBPCAP_INC_DIR ) {
54 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH 54 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH
55} 55}
56!isEmpty( LIBPCAP_LIB_DIR ) { 56!isEmpty( LIBPCAP_LIB_DIR ) {
57 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS 57 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS
58} 58}
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index f24e09f..587faad 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -357,106 +357,99 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
357 for ( ; it.current(); ++it ) 357 for ( ; it.current(); ++it )
358 { 358 {
359 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 359 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
360 { 360 {
361 361
362 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); 362 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
363 363
364 while ( subitem && ( subitem->text( col_essid ) != name ) ) 364 while ( subitem && ( subitem->text( col_essid ) != name ) )
365 { 365 {
366 #ifdef DEBUG 366 #ifdef DEBUG
367 odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl; 367 odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl;
368 #endif 368 #endif
369 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 369 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
370 } 370 }
371 371
372 if ( subitem ) 372 if ( subitem )
373 { 373 {
374 // we have already seen this item, it's a dupe 374 // we have already seen this item, it's a dupe
375 #ifdef DEBUG 375 #ifdef DEBUG
376 odebug << "" << name << " is a dupe - ignoring..." << oendl; 376 odebug << "" << name << " is a dupe - ignoring..." << oendl;
377 #endif 377 #endif
378 subitem->receivedBeacon(); //FIXME: sent data bit 378 subitem->receivedBeacon(); //FIXME: sent data bit
379 return; 379 return;
380 } 380 }
381 381
382 // never seen that - add new item 382 // never seen that - add new item
383 383
384 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); 384 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
385 item->setText( col_essid, name ); 385 item->setText( col_essid, name );
386 386
387 return; 387 return;
388 } 388 }
389 } 389 }
390 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; 390 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
391 MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!") 391 MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!")
392 .arg( macaddr.toString() ).arg( ip ) ); 392 .arg( macaddr.toString() ).arg( ip ) );
393} 393}
394 394
395 395
396void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 396void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
397{ 397{
398 if ( !item ) return; 398 if ( !item ) return;
399 399
400 MScanListItem* itm = static_cast<MScanListItem*>( item ); 400 MScanListItem* itm = static_cast<MScanListItem*>( item );
401 401
402 odebug << "contextMenuRequested on item '" << itm->text(0) << "' (" 402 odebug << "contextMenuRequested on item '" << itm->text(0) << "' ("
403 << itm->type << ") in column: '" << col << "'" << oendl; 403 << itm->type << ") in column: '" << col << "'" << oendl;
404 404
405 if ( itm->type == "adhoc" || itm->type == "managed" ) 405 /* do something meaningful */
406 {
407 QString entry = QString( "&Join %1 Net '%2'..." ).arg( itm->type ).arg( itm->essid() );
408 406
409 QPopupMenu m( this ); 407 return;
410 m.insertItem( entry, 37773, 0 );
411 int result = m.exec( QCursor::pos() );
412 if ( result == 37773 )
413 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
414 }
415} 408}
416 409
417//============================================================ 410//============================================================
418// MScanListItem 411// MScanListItem
419//============================================================ 412//============================================================
420 413
421MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, 414MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
422 bool wep, int channel, int signal, bool probed ) 415 bool wep, int channel, int signal, bool probed )
423 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 416 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
424 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 417 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
425 _channel( channel ), _signal( signal ), _beacons( 1 ) 418 _channel( channel ), _signal( signal ), _beacons( 1 )
426{ 419{
427 #ifdef DEBUG 420 #ifdef DEBUG
428 odebug << "creating scanlist item" << oendl; 421 odebug << "creating scanlist item" << oendl;
429 #endif 422 #endif
430 423
431 if ( WellenreiterConfigWindow::instance() ) 424 if ( WellenreiterConfigWindow::instance() )
432 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 425 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
433 426
434 decorateItem( type, essid, macaddr, wep, channel, signal, probed ); 427 decorateItem( type, essid, macaddr, wep, channel, signal, probed );
435} 428}
436 429
437MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, 430MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
438 bool wep, int channel, int signal ) 431 bool wep, int channel, int signal )
439 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 432 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
440{ 433{
441 #ifdef DEBUG 434 #ifdef DEBUG
442 odebug << "creating scanlist item" << oendl; 435 odebug << "creating scanlist item" << oendl;
443 #endif 436 #endif
444 if ( WellenreiterConfigWindow::instance() ) 437 if ( WellenreiterConfigWindow::instance() )
445 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 438 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
446 439
447 decorateItem( type, essid, macaddr, wep, channel, signal, false ); 440 decorateItem( type, essid, macaddr, wep, channel, signal, false );
448} 441}
449 442
450const QString& MScanListItem::essid() const 443const QString& MScanListItem::essid() const
451{ 444{
452 if ( type == "network" ) 445 if ( type == "network" )
453 return _essid; 446 return _essid;
454 else 447 else
455 return ( (MScanListItem*) parent() )->essid(); 448 return ( (MScanListItem*) parent() )->essid();
456} 449}
457 450
458OListViewItem* MScanListItem::childFactory() 451OListViewItem* MScanListItem::childFactory()
459{ 452{
460 return new MScanListItem( this ); 453 return new MScanListItem( this );
461} 454}
462 455
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 8b3814a..eec51af 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -10,97 +10,96 @@
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 "gps.h" 19#include "gps.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/olistview.h> 22#include <opie2/olistview.h>
23#include <opie2/onetutils.h> 23#include <opie2/onetutils.h>
24 24
25/* QT */ 25/* QT */
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28class QString; 28class QString;
29class MScanListItem; 29class MScanListItem;
30 30
31class MScanListView: public Opie::Ui::OListView 31class MScanListView: public Opie::Ui::OListView
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35 public: 35 public:
36 MScanListView( QWidget* parent = 0, const char* name = 0 ); 36 MScanListView( QWidget* parent = 0, const char* name = 0 );
37 virtual ~MScanListView(); 37 virtual ~MScanListView();
38 38
39 virtual Opie::Ui::OListViewItem* childFactory(); 39 virtual Opie::Ui::OListViewItem* childFactory();
40 virtual void serializeTo( QDataStream& s ) const; 40 virtual void serializeTo( QDataStream& s ) const;
41 virtual void serializeFrom( QDataStream& s ); 41 virtual void serializeFrom( QDataStream& s );
42 42
43 public slots: 43 public slots:
44 void addNewItem( const QString& type, const QString&, const Opie::Net::OMacAddress&, bool, int, int, const GpsLocation&, bool = false ); 44 void addNewItem( const QString& type, const QString&, const Opie::Net::OMacAddress&, bool, int, int, const GpsLocation&, bool = false );
45 void addService( const QString& name, const Opie::Net::OMacAddress& macaddr, const QString& ip ); 45 void addService( const QString& name, const Opie::Net::OMacAddress& macaddr, const QString& ip );
46 46
47 void fromDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via ); 47 void fromDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
48 void toDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via ); 48 void toDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
49 void WDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& viaFrom, const Opie::Net::OMacAddress& viaTo ); 49 void WDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& viaFrom, const Opie::Net::OMacAddress& viaTo );
50 void IBSStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via ); 50 void IBSStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
51 51
52 void identify( const Opie::Net::OMacAddress&, const QString& ipaddr ); 52 void identify( const Opie::Net::OMacAddress&, const QString& ipaddr );
53 53
54 void contextMenuRequested( QListViewItem* item, const QPoint&, int ); 54 void contextMenuRequested( QListViewItem* item, const QPoint&, int );
55 55
56 signals: 56 signals:
57 void rightButtonClicked(QListViewItem*,const QPoint&,int); 57 void rightButtonClicked(QListViewItem*,const QPoint&,int);
58 void joinNetwork( const QString&, const QString&, int, const QString& );
59 58
60 protected: 59 protected:
61 void addIfNotExisting( MScanListItem* parent, const Opie::Net::OMacAddress& addr, const QString& type = "station" ); 60 void addIfNotExisting( MScanListItem* parent, const Opie::Net::OMacAddress& addr, const QString& type = "station" );
62 61
63}; 62};
64 63
65//****************************** MScanListItem **************************************************************** 64//****************************** MScanListItem ****************************************************************
66 65
67class MScanListItem: public Opie::Ui::OListViewItem 66class MScanListItem: public Opie::Ui::OListViewItem
68{ 67{
69 public: 68 public:
70 MScanListItem::MScanListItem( QListView* parent, 69 MScanListItem::MScanListItem( QListView* parent,
71 const QString& type = "unknown", 70 const QString& type = "unknown",
72 const QString& essid = "unknown", 71 const QString& essid = "unknown",
73 const QString& macaddr = "unknown", 72 const QString& macaddr = "unknown",
74 bool wep = false, 73 bool wep = false,
75 int channel = 0, 74 int channel = 0,
76 int signal = 0, 75 int signal = 0,
77 bool probed = false ); 76 bool probed = false );
78 77
79 MScanListItem::MScanListItem( QListViewItem* parent, 78 MScanListItem::MScanListItem( QListViewItem* parent,
80 const QString& type = "unknown", 79 const QString& type = "unknown",
81 const QString& essid = "unknown", 80 const QString& essid = "unknown",
82 const QString& macaddr = "unknown", 81 const QString& macaddr = "unknown",
83 bool wep = false, 82 bool wep = false,
84 int channel = 0, 83 int channel = 0,
85 int signal = 0 ); 84 int signal = 0 );
86 85
87 86
88 protected: 87 protected:
89 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ); 88 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed );
90 89
91 public: 90 public:
92 QString type; 91 QString type;
93 92
94 public: 93 public:
95 //const QString& type() { return _type; }; 94 //const QString& type() { return _type; };
96 const QString& essid() const; 95 const QString& essid() const;
97 const QString& macaddr() { return _macaddr; }; 96 const QString& macaddr() { return _macaddr; };
98 bool wep() { return _wep; }; 97 bool wep() { return _wep; };
99 int channel() { return _channel; }; 98 int channel() { return _channel; };
100 int signal() { return _signal; }; 99 int signal() { return _signal; };
101 int beacons() { return _beacons; }; 100 int beacons() { return _beacons; };
102 101
103 void setSignal( int signal ) { /* TODO */ }; 102 void setSignal( int signal ) { /* TODO */ };
104 void receivedBeacon(); 103 void receivedBeacon();
105 104
106 void setManufacturer( const QString& manufacturer ); 105 void setManufacturer( const QString& manufacturer );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 8cabf0d..c4e6f02 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -37,98 +37,96 @@
37/* QT */ 37/* QT */
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qdatetime.h> 40#include <qdatetime.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qlineedit.h> 42#include <qlineedit.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qobjectlist.h> 44#include <qobjectlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qspinbox.h> 46#include <qspinbox.h>
47#include <qtimer.h> 47#include <qtimer.h>
48#include <qtoolbutton.h> 48#include <qtoolbutton.h>
49#include <qmainwindow.h> 49#include <qmainwindow.h>
50 50
51/* STD */ 51/* STD */
52#include <assert.h> 52#include <assert.h>
53#include <errno.h> 53#include <errno.h>
54#include <unistd.h> 54#include <unistd.h>
55#include <string.h> 55#include <string.h>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <stdlib.h> 57#include <stdlib.h>
58#include <signal.h> 58#include <signal.h>
59 59
60 60
61using namespace Opie::Core; 61using namespace Opie::Core;
62using namespace Opie::Net; 62using namespace Opie::Net;
63using namespace Opie::Ui; 63using namespace Opie::Ui;
64 64
65Wellenreiter* Wellenreiter::instance = 0; 65Wellenreiter* Wellenreiter::instance = 0;
66 66
67Wellenreiter::Wellenreiter( QWidget* parent ) 67Wellenreiter::Wellenreiter( QWidget* parent )
68 : WellenreiterBase( parent, 0, 0 ), 68 : WellenreiterBase( parent, 0, 0 ),
69 sniffing( false ), iface( 0 ), configwindow( 0 ) 69 sniffing( false ), iface( 0 ), configwindow( 0 )
70{ 70{
71 71
72 logwindow->log( "(i) Wellenreiter has been started." ); 72 logwindow->log( "(i) Wellenreiter has been started." );
73 73
74 // 74 //
75 // detect operating system 75 // detect operating system
76 // 76 //
77 77
78 #ifdef QWS 78 #ifdef QWS
79 QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); 79 QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() );
80 _system = ODevice::inst()->system(); 80 _system = ODevice::inst()->system();
81 logwindow->log( sys ); 81 logwindow->log( sys );
82 #endif 82 #endif
83 83
84 netview->setColumnWidthMode( 1, QListView::Manual ); 84 netview->setColumnWidthMode( 1, QListView::Manual );
85 connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
86 this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
87 pcap = new OPacketCapturer(); 85 pcap = new OPacketCapturer();
88 pcap->setAutoDelete( false ); 86 pcap->setAutoDelete( false );
89 87
90 gps = new GPS( this ); 88 gps = new GPS( this );
91 89
92 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); 90 QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
93 91
94 registerSignalHandler(); 92 registerSignalHandler();
95} 93}
96 94
97 95
98Wellenreiter::~Wellenreiter() 96Wellenreiter::~Wellenreiter()
99{ 97{
100 delete pcap; 98 delete pcap;
101 //unregisterSignalHandler(); 99 //unregisterSignalHandler();
102} 100}
103 101
104 102
105void Wellenreiter::initialTimer() 103void Wellenreiter::initialTimer()
106{ 104{
107 odebug << "preloading manufacturer database..." << oendl; 105 odebug << "preloading manufacturer database..." << oendl;
108 OManufacturerDB::instance(); 106 OManufacturerDB::instance();
109} 107}
110 108
111 109
112void Wellenreiter::signalHandler( int sig ) 110void Wellenreiter::signalHandler( int sig )
113{ 111{
114 Q_UNUSED( sig ) 112 Q_UNUSED( sig )
115 oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; 113 oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl;
116 if ( Wellenreiter::instance->sniffing ) 114 if ( Wellenreiter::instance->sniffing )
117 { 115 {
118 Wellenreiter::instance->pcap->closeDumpFile(); 116 Wellenreiter::instance->pcap->closeDumpFile();
119 Wellenreiter::instance->pcap->close(); 117 Wellenreiter::instance->pcap->close();
120 Wellenreiter::instance->stopClicked(); 118 Wellenreiter::instance->stopClicked();
121 } 119 }
122 oerr << "Phew. Seemed to work." << oendl; 120 oerr << "Phew. Seemed to work." << oendl;
123 ::exit( -1 ); 121 ::exit( -1 );
124} 122}
125 123
126 124
127void Wellenreiter::registerSignalHandler() 125void Wellenreiter::registerSignalHandler()
128{ 126{
129 Wellenreiter::instance = this; 127 Wellenreiter::instance = this;
130 struct sigaction action; 128 struct sigaction action;
131 129
132 action.sa_handler = Wellenreiter::signalHandler; 130 action.sa_handler = Wellenreiter::signalHandler;
133 if (sigemptyset(&action.sa_mask)) 131 if (sigemptyset(&action.sa_mask))
134 oerr << "sigemptyset() failure:" << strerror( errno ) << oendl; 132 oerr << "sigemptyset() failure:" << strerror( errno ) << oendl;
@@ -683,97 +681,60 @@ void Wellenreiter::startClicked()
683 { 681 {
684 assert( parent() ); 682 assert( parent() );
685 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); 683 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
686 } 684 }
687} 685}
688 686
689 687
690void Wellenreiter::timerEvent( QTimerEvent* ) 688void Wellenreiter::timerEvent( QTimerEvent* )
691{ 689{
692 odebug << "Wellenreiter::timerEvent()" << oendl; 690 odebug << "Wellenreiter::timerEvent()" << oendl;
693 OPacket* p = pcap->next(); 691 OPacket* p = pcap->next();
694 if ( !p ) // no more packets available 692 if ( !p ) // no more packets available
695 { 693 {
696 stopClicked(); 694 stopClicked();
697 } 695 }
698 else 696 else
699 { 697 {
700 receivePacket( p ); 698 receivePacket( p );
701 // We no longer delete packets here. Ownership of the packets is 699 // We no longer delete packets here. Ownership of the packets is
702 // transferred to the PacketView. 700 // transferred to the PacketView.
703 //delete p; 701 //delete p;
704 } 702 }
705} 703}
706 704
707 705
708void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) 706void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ )
709{ 707{
710 #ifdef QWS 708 #ifdef QWS
711 if ( action == "TouchSound" ) 709 if ( action == "TouchSound" )
712 ODevice::inst()->playTouchSound(); 710 ODevice::inst()->playTouchSound();
713 else if ( action == "AlarmSound" ) 711 else if ( action == "AlarmSound" )
714 ODevice::inst()->playAlarmSound(); 712 ODevice::inst()->playAlarmSound();
715 else if ( action == "KeySound" ) 713 else if ( action == "KeySound" )
716 ODevice::inst()->playKeySound(); 714 ODevice::inst()->playKeySound();
717 else if ( action == "LedOn" ) 715 else if ( action == "LedOn" )
718 ODevice::inst()->setLedState( Led_Mail, Led_On ); 716 ODevice::inst()->setLedState( Led_Mail, Led_On );
719 else if ( action == "LedOff" ) 717 else if ( action == "LedOff" )
720 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 718 ODevice::inst()->setLedState( Led_Mail, Led_Off );
721 else if ( action == "LogMessage" ) 719 else if ( action == "LogMessage" )
722 logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); 720 logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) );
723 else if ( action == "MessageBox" ) 721 else if ( action == "MessageBox" )
724 QMessageBox::information( this, "Notification!", 722 QMessageBox::information( this, "Notification!",
725 QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); 723 QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) );
726 #else 724 #else
727 #warning Actions do not work with Qt/X11 yet 725 #warning Actions do not work with Qt/X11 yet
728 #endif 726 #endif
729} 727}
730 728
731void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
732{
733 #ifdef QWS
734 if ( !iface )
735 {
736 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
737 return;
738 }
739
740 if ( sniffing )
741 {
742 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
743 return;
744 }
745
746 odebug << "joinNetwork() with Interface " << iface->name()
747 << ": " << type << ", " << essid
748 << ", " << channel << ", " << macaddr << oendl;
749
750 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
751 int count = 3;
752 odebug << "sending " << count << " messages" << oendl;
753 msg << QString("count") << QString::number(count);
754 odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
755 msg << QString(iface->name()) << QString("Mode") << type;
756 odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
757 msg << QString(iface->name()) << QString("ESSID") << essid;
758 odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
759 msg << QString(iface->name()) << QString("Channel") << channel;
760// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
761// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
762 #else
763 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
764 #endif
765
766}
767
768void Wellenreiter::updateStatistics() 729void Wellenreiter::updateStatistics()
769{ 730{
770 // print out statistics 731 // print out statistics
771 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) 732 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
772 statwindow->updateCounter( it.key(), it.data() ); 733 statwindow->updateCounter( it.key(), it.data() );
773} 734}
774 735
775void Wellenreiter::slotTabChanged( QWidget* wid ) 736void Wellenreiter::slotTabChanged( QWidget* wid )
776{ 737{
777 if ( wid == statwindow ) 738 if ( wid == statwindow )
778 updateStatistics(); 739 updateStatistics();
779} 740}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 5ac389e..1c9633d 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -26,92 +26,90 @@ class QTimerEvent;
26class QPixmap; 26class QPixmap;
27namespace Opie {namespace Net {class OPacket;}} 27namespace Opie {namespace Net {class OPacket;}}
28namespace Opie {namespace Net {class OWaveLanManagementPacket;}} 28namespace Opie {namespace Net {class OWaveLanManagementPacket;}}
29namespace Opie {namespace Net {class OWaveLanControlPacket;}} 29namespace Opie {namespace Net {class OWaveLanControlPacket;}}
30namespace Opie {namespace Net {class OWaveLanDataPacket;}} 30namespace Opie {namespace Net {class OWaveLanDataPacket;}}
31namespace Opie {namespace Net {class OEthernetPacket;}} 31namespace Opie {namespace Net {class OEthernetPacket;}}
32namespace Opie {namespace Net {class OARPPacket;}} 32namespace Opie {namespace Net {class OARPPacket;}}
33namespace Opie {namespace Net {class OMacAddress;}} 33namespace Opie {namespace Net {class OMacAddress;}}
34namespace Opie {namespace Net {class OIPPacket;}} 34namespace Opie {namespace Net {class OIPPacket;}}
35namespace Opie {namespace Net {class OPacket;}} 35namespace Opie {namespace Net {class OPacket;}}
36namespace Opie {namespace Net {class OWirelessNetworkInterface;}} 36namespace Opie {namespace Net {class OWirelessNetworkInterface;}}
37namespace Opie {namespace Net {class OPacketCapturer;}} 37namespace Opie {namespace Net {class OPacketCapturer;}}
38class PacketView; 38class PacketView;
39class WellenreiterConfigWindow; 39class WellenreiterConfigWindow;
40class MLogWindow; 40class MLogWindow;
41class GPS; 41class GPS;
42 42
43class Wellenreiter : public WellenreiterBase { 43class Wellenreiter : public WellenreiterBase {
44 Q_OBJECT 44 Q_OBJECT
45 45
46 public: 46 public:
47 Wellenreiter( QWidget* parent = 0 ); 47 Wellenreiter( QWidget* parent = 0 );
48 ~Wellenreiter(); 48 ~Wellenreiter();
49 49
50 void setConfigWindow( WellenreiterConfigWindow* cw ); 50 void setConfigWindow( WellenreiterConfigWindow* cw );
51 MScanListView* netView() const { return netview; }; 51 MScanListView* netView() const { return netview; };
52 MLogWindow* logWindow() const { return logwindow; }; 52 MLogWindow* logWindow() const { return logwindow; };
53 PacketView* hexWindow() const { return hexwindow; }; 53 PacketView* hexWindow() const { return hexwindow; };
54 bool isDaemonRunning() const { return sniffing; }; 54 bool isDaemonRunning() const { return sniffing; };
55 QString captureFileName() const { return dumpname; }; 55 QString captureFileName() const { return dumpname; };
56 56
57 public: 57 public:
58 QString dumpname; 58 QString dumpname;
59 bool sniffing; 59 bool sniffing;
60 static Wellenreiter* instance; 60 static Wellenreiter* instance;
61 static void signalHandler( int sig ); 61 static void signalHandler( int sig );
62 62
63 protected: 63 protected:
64 virtual void timerEvent( QTimerEvent* ); 64 virtual void timerEvent( QTimerEvent* );
65 65
66 public slots: 66 public slots:
67 void initialTimer(); 67 void initialTimer();
68 68
69 void channelHopped(int); 69 void channelHopped(int);
70 void receivePacket(Opie::Net::OPacket*); 70 void receivePacket(Opie::Net::OPacket*);
71 void startClicked(); 71 void startClicked();
72 void stopClicked(); 72 void stopClicked();
73 73
74 void joinNetwork(const QString&,const QString&,int,const QString&);
75
76 signals: 74 signals:
77 void startedSniffing(); 75 void startedSniffing();
78 void stoppedSniffing(); 76 void stoppedSniffing();
79 77
80 private: 78 private:
81 void handleManagementFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 79 void handleManagementFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
82 void handleManagementFrameBeacon( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 80 void handleManagementFrameBeacon( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
83 void handleManagementFrameProbeRequest( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 81 void handleManagementFrameProbeRequest( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
84 void handleManagementFrameProbeResponse( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* ); 82 void handleManagementFrameProbeResponse( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
85 void handleControlFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanControlPacket* control ); 83 void handleControlFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanControlPacket* control );
86 void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 84 void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
87 void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 85 void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
88 void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 86 void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
89 void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); 87 void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
90 void handleNotification( Opie::Net::OPacket* p ); 88 void handleNotification( Opie::Net::OPacket* p );
91 void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p ); 89 void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p );
92 QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); 90 QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol );
93 bool checkDumpPacket( Opie::Net::OPacket* p ); 91 bool checkDumpPacket( Opie::Net::OPacket* p );
94 void registerSignalHandler(); 92 void registerSignalHandler();
95 93
96 private slots: 94 private slots:
97 void slotTabChanged( QWidget* ); 95 void slotTabChanged( QWidget* );
98 96
99 private: 97 private:
100 void updateStatistics(); 98 void updateStatistics();
101 99
102 #ifdef QWS 100 #ifdef QWS
103 Opie::Core::OSystem _system; // Opie Operating System identifier 101 Opie::Core::OSystem _system; // Opie Operating System identifier
104 #endif 102 #endif
105 103
106 Opie::Net::OWirelessNetworkInterface* iface; 104 Opie::Net::OWirelessNetworkInterface* iface;
107 Opie::Net::OPacketCapturer* pcap; 105 Opie::Net::OPacketCapturer* pcap;
108 WellenreiterConfigWindow* configwindow; 106 WellenreiterConfigWindow* configwindow;
109 GPS* gps; 107 GPS* gps;
110 108
111 //void readConfig(); 109 //void readConfig();
112 //void writeConfig(); 110 //void writeConfig();
113}; 111};
114 112
115 113
116 114
117#endif 115#endif
diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro
index e995db9..673868f 100644
--- a/noncore/net/wellenreiter/wellenreiter.pro
+++ b/noncore/net/wellenreiter/wellenreiter.pro
@@ -1,15 +1,15 @@
1TEMPLATE = subdirs 1TEMPLATE = subdirs
2VERSION = 1.0.3-cvs 2VERSION = 1.0.5-cvs
3 3
4!contains( platform, x11 ) { 4!contains( platform, x11 ) {
5 message( Configuring Wellenreiter for build on Opie ) 5 message( Configuring Wellenreiter for build on Opie )
6 SUBDIRS = gui 6 SUBDIRS = gui
7 include( $(OPIEDIR)/include.pro ) 7 include( $(OPIEDIR)/include.pro )
8} 8}
9 9
10contains( platform, x11 ) { 10contains( platform, x11 ) {
11 message( Configuring Wellenreiter for build on Qt/X11 ) 11 message( Configuring Wellenreiter for build on Qt/X11 )
12 SUBDIRS = lib gui 12 SUBDIRS = lib gui
13 system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics ) 13 system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics )
14} 14}
15 15