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) (side-by-side diff)
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 @@
DESTDIR = $(OPIEDIR)/bin
TEMPLATE = app
CONFIG = qt warn_on
HEADERS = wellenreiterbase.h \
mainwindow.h \
wellenreiter.h \
scanlist.h \
logwindow.h \
hexwindow.h \
statwindow.h \
configwindow.h \
graphwindow.h \
packetview.h \
protolistview.h \
gps.h
SOURCES = main.cpp \
mainwindow.cpp \
wellenreiterbase.cpp \
wellenreiter.cpp \
scanlist.cpp \
logwindow.cpp \
hexwindow.cpp \
statwindow.cpp \
configwindow.cpp \
graphwindow.cpp \
packetview.cpp \
protolistview.cpp \
gps.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
INTERFACES = configbase.ui
TARGET = wellenreiter
-VERSION = 1.0.5
+VERSION = 1.0.6
DEFINES += WELLENREITER_VERSION='"$$VERSION (GPL) Opie"'
!contains( platform, x11 ) {
message( qws )
include( $(OPIEDIR)/include.pro )
LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2
}
contains( platform, x11 ) {
LIBS += -L$(OPIEDIR)/output/lib -Wl,-rpath,$(OPIEDIR)/output/lib -Wl,-rpath,/usr/local/lib -lwellenreiter
SOURCES += resource.cpp
HEADERS += resource.h
DESTDIR = $(OPIEDIR)/output/bin
}
!isEmpty( LIBPCAP_INC_DIR ) {
INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH
}
!isEmpty( LIBPCAP_LIB_DIR ) {
LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS
}
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,
for ( ; it.current(); ++it )
{
if ( it.current()->text( col_ap ) == macaddr.toString(true) )
{
MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
while ( subitem && ( subitem->text( col_essid ) != name ) )
{
#ifdef DEBUG
odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl;
#endif
subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
}
if ( subitem )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
odebug << "" << name << " is a dupe - ignoring..." << oendl;
#endif
subitem->receivedBeacon(); //FIXME: sent data bit
return;
}
// never seen that - add new item
MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
item->setText( col_essid, name );
return;
}
}
odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!")
.arg( macaddr.toString() ).arg( ip ) );
}
void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
{
if ( !item ) return;
MScanListItem* itm = static_cast<MScanListItem*>( item );
odebug << "contextMenuRequested on item '" << itm->text(0) << "' ("
<< itm->type << ") in column: '" << col << "'" << oendl;
- if ( itm->type == "adhoc" || itm->type == "managed" )
- {
- QString entry = QString( "&Join %1 Net '%2'..." ).arg( itm->type ).arg( itm->essid() );
+ /* do something meaningful */
- QPopupMenu m( this );
- m.insertItem( entry, 37773, 0 );
- int result = m.exec( QCursor::pos() );
- if ( result == 37773 )
- emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
- }
+ return;
}
//============================================================
// MScanListItem
//============================================================
MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
bool wep, int channel, int signal, bool probed )
:OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
_type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
_channel( channel ), _signal( signal ), _beacons( 1 )
{
#ifdef DEBUG
odebug << "creating scanlist item" << oendl;
#endif
if ( WellenreiterConfigWindow::instance() )
WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
decorateItem( type, essid, macaddr, wep, channel, signal, probed );
}
MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
bool wep, int channel, int signal )
:OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
{
#ifdef DEBUG
odebug << "creating scanlist item" << oendl;
#endif
if ( WellenreiterConfigWindow::instance() )
WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
decorateItem( type, essid, macaddr, wep, channel, signal, false );
}
const QString& MScanListItem::essid() const
{
if ( type == "network" )
return _essid;
else
return ( (MScanListItem*) parent() )->essid();
}
OListViewItem* MScanListItem::childFactory()
{
return new MScanListItem( this );
}
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 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef SCANLIST_H
#define SCANLIST_H
#include "gps.h"
/* OPIE */
#include <opie2/olistview.h>
#include <opie2/onetutils.h>
/* QT */
#include <qtextstream.h>
class QString;
class MScanListItem;
class MScanListView: public Opie::Ui::OListView
{
Q_OBJECT
public:
MScanListView( QWidget* parent = 0, const char* name = 0 );
virtual ~MScanListView();
virtual Opie::Ui::OListViewItem* childFactory();
virtual void serializeTo( QDataStream& s ) const;
virtual void serializeFrom( QDataStream& s );
public slots:
void addNewItem( const QString& type, const QString&, const Opie::Net::OMacAddress&, bool, int, int, const GpsLocation&, bool = false );
void addService( const QString& name, const Opie::Net::OMacAddress& macaddr, const QString& ip );
void fromDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
void toDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
void WDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& viaFrom, const Opie::Net::OMacAddress& viaTo );
void IBSStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
void identify( const Opie::Net::OMacAddress&, const QString& ipaddr );
void contextMenuRequested( QListViewItem* item, const QPoint&, int );
signals:
void rightButtonClicked(QListViewItem*,const QPoint&,int);
- void joinNetwork( const QString&, const QString&, int, const QString& );
protected:
void addIfNotExisting( MScanListItem* parent, const Opie::Net::OMacAddress& addr, const QString& type = "station" );
};
//****************************** MScanListItem ****************************************************************
class MScanListItem: public Opie::Ui::OListViewItem
{
public:
MScanListItem::MScanListItem( QListView* parent,
const QString& type = "unknown",
const QString& essid = "unknown",
const QString& macaddr = "unknown",
bool wep = false,
int channel = 0,
int signal = 0,
bool probed = false );
MScanListItem::MScanListItem( QListViewItem* parent,
const QString& type = "unknown",
const QString& essid = "unknown",
const QString& macaddr = "unknown",
bool wep = false,
int channel = 0,
int signal = 0 );
protected:
virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed );
public:
QString type;
public:
//const QString& type() { return _type; };
const QString& essid() const;
const QString& macaddr() { return _macaddr; };
bool wep() { return _wep; };
int channel() { return _channel; };
int signal() { return _signal; };
int beacons() { return _beacons; };
void setSignal( int signal ) { /* TODO */ };
void receivedBeacon();
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 @@
/* QT */
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qdatetime.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qmessagebox.h>
#include <qobjectlist.h>
#include <qregexp.h>
#include <qspinbox.h>
#include <qtimer.h>
#include <qtoolbutton.h>
#include <qmainwindow.h>
/* STD */
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
#include <signal.h>
using namespace Opie::Core;
using namespace Opie::Net;
using namespace Opie::Ui;
Wellenreiter* Wellenreiter::instance = 0;
Wellenreiter::Wellenreiter( QWidget* parent )
: WellenreiterBase( parent, 0, 0 ),
sniffing( false ), iface( 0 ), configwindow( 0 )
{
logwindow->log( "(i) Wellenreiter has been started." );
//
// detect operating system
//
#ifdef QWS
QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() );
_system = ODevice::inst()->system();
logwindow->log( sys );
#endif
netview->setColumnWidthMode( 1, QListView::Manual );
- connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
- this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
pcap = new OPacketCapturer();
pcap->setAutoDelete( false );
gps = new GPS( this );
QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
registerSignalHandler();
}
Wellenreiter::~Wellenreiter()
{
delete pcap;
//unregisterSignalHandler();
}
void Wellenreiter::initialTimer()
{
odebug << "preloading manufacturer database..." << oendl;
OManufacturerDB::instance();
}
void Wellenreiter::signalHandler( int sig )
{
Q_UNUSED( sig )
oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl;
if ( Wellenreiter::instance->sniffing )
{
Wellenreiter::instance->pcap->closeDumpFile();
Wellenreiter::instance->pcap->close();
Wellenreiter::instance->stopClicked();
}
oerr << "Phew. Seemed to work." << oendl;
::exit( -1 );
}
void Wellenreiter::registerSignalHandler()
{
Wellenreiter::instance = this;
struct sigaction action;
action.sa_handler = Wellenreiter::signalHandler;
if (sigemptyset(&action.sa_mask))
oerr << "sigemptyset() failure:" << strerror( errno ) << oendl;
@@ -683,97 +681,60 @@ void Wellenreiter::startClicked()
{
assert( parent() );
( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
}
}
void Wellenreiter::timerEvent( QTimerEvent* )
{
odebug << "Wellenreiter::timerEvent()" << oendl;
OPacket* p = pcap->next();
if ( !p ) // no more packets available
{
stopClicked();
}
else
{
receivePacket( p );
// We no longer delete packets here. Ownership of the packets is
// transferred to the PacketView.
//delete p;
}
}
void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ )
{
#ifdef QWS
if ( action == "TouchSound" )
ODevice::inst()->playTouchSound();
else if ( action == "AlarmSound" )
ODevice::inst()->playAlarmSound();
else if ( action == "KeySound" )
ODevice::inst()->playKeySound();
else if ( action == "LedOn" )
ODevice::inst()->setLedState( Led_Mail, Led_On );
else if ( action == "LedOff" )
ODevice::inst()->setLedState( Led_Mail, Led_Off );
else if ( action == "LogMessage" )
logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) );
else if ( action == "MessageBox" )
QMessageBox::information( this, "Notification!",
QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) );
#else
#warning Actions do not work with Qt/X11 yet
#endif
}
-void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
-{
- #ifdef QWS
- if ( !iface )
- {
- QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
- return;
- }
-
- if ( sniffing )
- {
- QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
- return;
- }
-
- odebug << "joinNetwork() with Interface " << iface->name()
- << ": " << type << ", " << essid
- << ", " << channel << ", " << macaddr << oendl;
-
- QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
- int count = 3;
- odebug << "sending " << count << " messages" << oendl;
- msg << QString("count") << QString::number(count);
- odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
- msg << QString(iface->name()) << QString("Mode") << type;
- odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
- msg << QString(iface->name()) << QString("ESSID") << essid;
- odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
- msg << QString(iface->name()) << QString("Channel") << channel;
-// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
-// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
- #else
- QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
- #endif
-
-}
-
void Wellenreiter::updateStatistics()
{
// print out statistics
for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
statwindow->updateCounter( it.key(), it.data() );
}
void Wellenreiter::slotTabChanged( QWidget* wid )
{
if ( wid == statwindow )
updateStatistics();
}
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;
class QPixmap;
namespace Opie {namespace Net {class OPacket;}}
namespace Opie {namespace Net {class OWaveLanManagementPacket;}}
namespace Opie {namespace Net {class OWaveLanControlPacket;}}
namespace Opie {namespace Net {class OWaveLanDataPacket;}}
namespace Opie {namespace Net {class OEthernetPacket;}}
namespace Opie {namespace Net {class OARPPacket;}}
namespace Opie {namespace Net {class OMacAddress;}}
namespace Opie {namespace Net {class OIPPacket;}}
namespace Opie {namespace Net {class OPacket;}}
namespace Opie {namespace Net {class OWirelessNetworkInterface;}}
namespace Opie {namespace Net {class OPacketCapturer;}}
class PacketView;
class WellenreiterConfigWindow;
class MLogWindow;
class GPS;
class Wellenreiter : public WellenreiterBase {
Q_OBJECT
public:
Wellenreiter( QWidget* parent = 0 );
~Wellenreiter();
void setConfigWindow( WellenreiterConfigWindow* cw );
MScanListView* netView() const { return netview; };
MLogWindow* logWindow() const { return logwindow; };
PacketView* hexWindow() const { return hexwindow; };
bool isDaemonRunning() const { return sniffing; };
QString captureFileName() const { return dumpname; };
public:
QString dumpname;
bool sniffing;
static Wellenreiter* instance;
static void signalHandler( int sig );
protected:
virtual void timerEvent( QTimerEvent* );
public slots:
void initialTimer();
void channelHopped(int);
void receivePacket(Opie::Net::OPacket*);
void startClicked();
void stopClicked();
- void joinNetwork(const QString&,const QString&,int,const QString&);
-
signals:
void startedSniffing();
void stoppedSniffing();
private:
void handleManagementFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
void handleManagementFrameBeacon( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
void handleManagementFrameProbeRequest( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
void handleManagementFrameProbeResponse( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
void handleControlFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanControlPacket* control );
void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleNotification( Opie::Net::OPacket* p );
void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p );
QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol );
bool checkDumpPacket( Opie::Net::OPacket* p );
void registerSignalHandler();
private slots:
void slotTabChanged( QWidget* );
private:
void updateStatistics();
#ifdef QWS
Opie::Core::OSystem _system; // Opie Operating System identifier
#endif
Opie::Net::OWirelessNetworkInterface* iface;
Opie::Net::OPacketCapturer* pcap;
WellenreiterConfigWindow* configwindow;
GPS* gps;
//void readConfig();
//void writeConfig();
};
#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 @@
TEMPLATE = subdirs
-VERSION = 1.0.3-cvs
+VERSION = 1.0.5-cvs
!contains( platform, x11 ) {
message( Configuring Wellenreiter for build on Opie )
SUBDIRS = gui
include( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
message( Configuring Wellenreiter for build on Qt/X11 )
SUBDIRS = lib gui
system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics )
}