From d11a0154e2d9732854c9a3d598857bc20f359849 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sun, 30 Mar 2003 01:51:14 +0000 Subject: - the network work for libopie2 pays off... - good bye to wellenreiterd, t'was fun but always too unstable and too hard to maintain - good bye to libwellenreiter --- (limited to 'noncore/net/wellenreiter') diff --git a/noncore/net/wellenreiter/Makefile.static b/noncore/net/wellenreiter/Makefile.static deleted file mode 100644 index d5cdf44..0000000 --- a/noncore/net/wellenreiter/Makefile.static +++ b/dev/null @@ -1,28 +0,0 @@ -# Warning: Handcrafted! - -############################################################################# -# Makefile for building targets in sub directories. -# Project: wellenreiter -# Template: subdirs -############################################################################# - -MAKEFILE= Makefile -TMAKE = tmake - -SUBDIRS = libwellenreiter/source daemon/source gui cornucopia - -all: $(SUBDIRS) - -$(SUBDIRS): FORCE - cd $@; $(MAKE) - -tmake: - tmake wellenreiter.pro - -tmake_all: - for i in $(SUBDIRS); do ( if [ -d $$i ]; then cd $$i ; pro=`basename $$i`.pro ; $(TMAKE) $$pro -o $(MAKEFILE); grep "TEMPLATE.*subdirs" $$pro 2>/dev/null >/dev/null && $(MAKE) -f $(MAKEFILE) tmake_all || true; fi; ) ; done - -clean release debug: - for i in $(SUBDIRS); do ( if [ -d $$i ]; then cd $$i ; $(MAKE) $@; fi; ) ; done - -FORCE: diff --git a/noncore/net/wellenreiter/config.in b/noncore/net/wellenreiter/config.in index 19f85e2..e835d1f 100644 --- a/noncore/net/wellenreiter/config.in +++ b/noncore/net/wellenreiter/config.in @@ -1,4 +1,6 @@ config WELLENREITER boolean "wellenreiter (wireless LAN monitor)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE && LIBOPIE2NET && LIBOPIE2UI + comment "wellenreiter needs libqpe, libopie1 and libopie2 (core+net+ui)" + depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBOPIE2CORE && LIBOPIE2NET && LIBOPIE2UI) diff --git a/noncore/net/wellenreiter/contrib/.cvsignore b/noncore/net/wellenreiter/contrib/.cvsignore deleted file mode 100644 index 0e45b67..0000000 --- a/noncore/net/wellenreiter/contrib/.cvsignore +++ b/dev/null @@ -1,4 +0,0 @@ -*.o -*~ -moc_* -Makefile.* diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore b/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore deleted file mode 100644 index 4299fd9..0000000 --- a/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore +++ b/dev/null @@ -1,4 +0,0 @@ -*.o -*~ -moc_* -Makefile* diff --git a/noncore/net/wellenreiter/cornucopia/.cvsignore b/noncore/net/wellenreiter/cornucopia/.cvsignore deleted file mode 100644 index 724d599..0000000 --- a/noncore/net/wellenreiter/cornucopia/.cvsignore +++ b/dev/null @@ -1,8 +0,0 @@ -*.o -*~ -Makefile* -moc_* -wellenreitertemplate.cpp -wellenreitertemplate.h -configbase.h -configbase.cpp diff --git a/noncore/net/wellenreiter/cornucopia/README b/noncore/net/wellenreiter/cornucopia/README deleted file mode 100644 index 486dc67..0000000 --- a/noncore/net/wellenreiter/cornucopia/README +++ b/dev/null @@ -1,124 +0,0 @@ -/******************************************************************** -/* This is an overview of the opielibs 1.2 project -/********************************************************************/ - - Origin: opielibs is about creating classes to - * optimize Qt classes for the embedded environment - * provide sophisticated abstractions for developers - * provide complete documentation and working examples - * provide end users with a common look and feel - * reduce memory footprint through sharing code - * reduce possible bugs through reusing tested code - --------------------------------------------------------- -1. General Overview --------------------------------------------------------- - -Separation into the following libraries: - - libopiecore - - libopieui - - libopiepim - - libopienet - -1.1 Contents of libopiecore [ opiecore ] --------------------------------------------------------- - - - oprocctrl - - oprocess - - odevice - - odevicebutton - - - oconfig - - oconfiggroupsaver - - ocompletionbase - - ocompletion - - ocomptreenodelist - - ocomptreenode - - ocompletionwrapper - - oglobal - - oglobalsettings - - osortableitem - - osortablevaluelist - -1.2 Contents of libopieui [ opieui ] --------------------------------------------------------- - - - oapplication - - - ofiledialog - - colordialog - - oclickablelabel - - ocolorbutton - - colorpopupmenu - - otabinfo - - otabbar - - otabwidget - - ofontmenu - - ofontselector - - ofileview - - oticker - - - olistview - - olistviewitem - - oversatileview - - oversatileviewitem - - ocompletionbox - - olineedit - - ocombobox - - ohistorycombo - - - omessagebox - - odialogbase - - - todayconfigwidget (rather into opiepim?) - - orecurrancewidget (rather into opiepim?) - - otimepicker (rather into opiepim?) - -1.3 Contents of libopiepim [ opiepim ] --------------------------------------------------------- - - - ocheckitem - - todoevent - - todoresource - - todayplugininterface - - todovcalresource - -1.4 Contents of libopiedb [ opiedb ] --------------------------------------------------------- - - - tododb - - xmltree - -1.5 Contents of libopienet [ opienet ] --------------------------------------------------------- - - - - - --------------------------------------------------------- -2.0 Feature Description --------------------------------------------------------- - -2.1 libopiecore - -... - -2.2 libopieui - -... - -2.2.x OListView, OListViewItem, OListViewFactory - -... - -2.3 libopiepim - -... - -2.4 libopiedb - -... - -2.5 libopienet - diff --git a/noncore/net/wellenreiter/cornucopia/cornucopia.pro b/noncore/net/wellenreiter/cornucopia/cornucopia.pro deleted file mode 100644 index 7ffa202..0000000 --- a/noncore/net/wellenreiter/cornucopia/cornucopia.pro +++ b/dev/null @@ -1,16 +0,0 @@ -DESTDIR = $(OPIEDIR)/lib -MOC_DIR = ./tmp -OBJECTS_DIR = ./tmp -TEMPLATE = lib -CONFIG = qt warn_on debug -VERSION = 0.1 -HEADERS = olistview.h -SOURCES = olistview.cpp -INCLUDEPATH = $(OPIEDIR)/include -DEPENDPATH = $(OPIEDIR)/include -TARGET = cornucopia - -!contains( platform, x11 ) { - include ( $(OPIEDIR)/include.pro ) -} - diff --git a/noncore/net/wellenreiter/cornucopia/olistview.cpp b/noncore/net/wellenreiter/cornucopia/olistview.cpp deleted file mode 100644 index c292eb9..0000000 --- a/noncore/net/wellenreiter/cornucopia/olistview.cpp +++ b/dev/null @@ -1,417 +0,0 @@ -/* -                 This file is part of the Opie Project - -              Copyright (C) 2003 Michael 'Mickey' Lauer - - =. - .=l. -           .>+-= - _;:,     .>    :=|. This program is free software; you can -.> <`_,   >  .   <= redistribute it and/or modify it under -:`=1 )Y*s>-.--   : the terms of the GNU Library General Public -.="- .-=="i,     .._ License as published by the Free Software - - .   .-<_>     .<> Foundation; either version 2 of the License, -     ._= =}       : or (at your option) any later version. -    .%`+i>       _;_. -    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU -..}^=.=       =       ; Library General Public License for more -++=   -.     .`     .: details. - :     =  ...= . :.=- - -.   .:....=;==+<; You should have received a copy of the GNU -  -_. . .   )=.  = Library General Public License along with -    --        :-=` this library; see the file COPYING.LIB. - If not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - -*/ - -#include -#include -#include -#include - -#include "olistview.h" - -//****************************** OListView ************************************************************************** - -OListView::OListView( QWidget *parent, const char *name ) - :QListView( parent, name ) -{ - //FIXME: get from global settings and calculate ==> see oglobalsettings.* - - m_alternateBackground = QColor( 238, 246, 255 ); - m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); - m_fullWidth = true; -} - -OListView::~OListView() -{ -} - -void OListView::setFullWidth( bool fullWidth ) -{ - m_fullWidth = m_fullWidth; - #if QT_VERSION > 290 - header()->setStretchEnabled( fullWidth, columns()-1 ); - #endif -} - -bool OListView::fullWidth() const -{ - return m_fullWidth; -} - -int OListView::addColumn( const QString& label, int width ) -{ - int result = QListView::addColumn( label, width ); - #if QT_VERSION > 290 - if (m_fullWidth) { - header()->setStretchEnabled( false, columns()-2 ); - header()->setStretchEnabled( true, columns()-1 ); - } - #endif - return result; -} - -int OListView::addColumn( const QIconSet& iconset, const QString& label, int width ) -{ - int result = QListView::addColumn( iconset, label, width ); - #if QT_VERSION > 290 - if (m_fullWidth) { - header()->setStretchEnabled( false, columns()-2 ); - header()->setStretchEnabled( true, columns()-1 ); - } - #endif - return result; -} - -void OListView::removeColumn( int index ) -{ - QListView::removeColumn(index); - #if QT_VERSION > 290 - if ( m_fullWidth && index == columns() ) - { - header()->setStretchEnabled( true, columns()-1 ); - } - #endif -} - -const QColor& OListView::alternateBackground() const -{ - return m_alternateBackground; -} - -void OListView::setAlternateBackground( const QColor &c ) -{ - m_alternateBackground = c; - repaint(); -} - -const QPen& OListView::columnSeparator() const -{ - return m_columnSeparator; -} - -void OListView::setColumnSeparator( const QPen& p ) -{ - m_columnSeparator = p; - repaint(); -} - -OListViewItem* OListView::childFactory() -{ - return new OListViewItem( this ); -} - -#ifndef QT_NO_DATASTREAM -void OListView::serializeTo( QDataStream& s ) const -{ - #warning Caution... the binary format is still under construction... - qDebug( "storing OListView..." ); - - // store number of columns and the labels - s << columns(); - for ( int i = 0; i < columns(); ++i ) - s << columnText( i ); - - // calculate the number of top-level items to serialize - int items = 0; - QListViewItem* item = firstChild(); - while ( item ) - { - item = item->nextSibling(); - items++; - } - - // store number of items and the items itself - s << items; - item = firstChild(); - for ( int i = 0; i < items; ++i ) - { - s << *static_cast( item ); - item = item->nextSibling(); - } - - qDebug( "OListview stored." ); -} - -void OListView::serializeFrom( QDataStream& s ) -{ - #warning Caution... the binary format is still under construction... - qDebug( "loading OListView..." ); - - int cols; - s >> cols; - qDebug( "read number of columns = %d", cols ); - - while ( columns() < cols ) addColumn( QString::null ); - - for ( int i = 0; i < cols; ++i ) - { - QString coltext; - s >> coltext; - qDebug( "read text '%s' for column %d", (const char*) coltext, i ); - setColumnText( i, coltext ); - } - - int items; - s >> items; - qDebug( "read number of items = %d", items ); - - for ( int i = 0; i < items; ++i ) - { - OListViewItem* item = childFactory(); - s >> *item; - } - - qDebug( "OListView loaded." ); - -} - -QDataStream& operator<<( QDataStream& s, const OListView& lv ) -{ - lv.serializeTo( s ); -} - -QDataStream& operator>>( QDataStream& s, OListView& lv ) -{ - lv.serializeFrom( s ); -} -#endif // QT_NO_DATASTREAM - -//****************************** OListViewItem *********************************************************************** - -OListViewItem::OListViewItem(QListView *parent) - : QListViewItem(parent) -{ - init(); -} - -OListViewItem::OListViewItem(QListViewItem *parent) - : QListViewItem(parent) -{ - init(); -} - -OListViewItem::OListViewItem(QListView *parent, QListViewItem *after) - : QListViewItem(parent, after) -{ - init(); -} - -OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after) - : QListViewItem(parent, after) -{ - init(); -} - -OListViewItem::OListViewItem(QListView *parent, - QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) -{ - init(); -} - -OListViewItem::OListViewItem(QListViewItem *parent, - QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) -{ - init(); -} - -OListViewItem::OListViewItem(QListView *parent, QListViewItem *after, - QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) -{ - init(); -} - -OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after, - QString label1, QString label2, QString label3, QString label4, - QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) -{ - init(); -} - -OListViewItem::~OListViewItem() -{ -} - -void OListViewItem::init() -{ - m_known = false; -} - -const QColor &OListViewItem::backgroundColor() -{ - return isAlternate() ? static_cast(listView())->alternateBackground() : - listView()->viewport()->colorGroup().base(); -} - -bool OListViewItem::isAlternate() -{ - OListView *lv = static_cast( listView() ); - - // check if the item above is an OListViewItem - OListViewItem *above = static_cast( itemAbove() ); - /*if (! itemAbove()->inherits( "OListViewItem" )) return false;*/ - - // check if we have a valid alternate background color - if (!(lv && lv->alternateBackground().isValid())) return false; - - m_known = above ? above->m_known : true; - if (m_known) - { - m_odd = above ? !above->m_odd : false; - } - else - { - OListViewItem *item; - bool previous = true; - if (parent()) - { - item = static_cast(parent()); - if ( item /*&& item->inherits( "OListViewItem" )*/ ) previous = item->m_odd; - item = static_cast(parent()->firstChild()); - /* if ( !item.inherits( "OListViewItem" ) item = 0; */ - } - else - { - item = static_cast(lv->firstChild()); - } - - while(item) - { - item->m_odd = previous = !previous; - item->m_known = true; - item = static_cast(item->nextSibling()); - /* if (!item.inherits( "OListViewItem" ) ) break; */ - } - } - return m_odd; -} - -void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) -{ - QColorGroup _cg = cg; - const QPixmap *pm = listView()->viewport()->backgroundPixmap(); - if (pm && !pm->isNull()) - { - _cg.setBrush( QColorGroup::Base, QBrush(backgroundColor(), *pm) ); - p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() ); - } - else if ( isAlternate() ) - { - _cg.setColor( QColorGroup::Base, static_cast( listView() )->alternateBackground() ); - } - QListViewItem::paintCell( p, _cg, column, width, alignment ); - - //FIXME: Use styling here! - - const QPen& pen = static_cast( listView() )->columnSeparator(); - p->setPen( pen ); - p->drawLine( width-1, 0, width-1, height() ); -} - -OListViewItem* OListViewItem::childFactory() -{ - return new OListViewItem( this ); -} - -#ifndef QT_NO_DATASTREAM -void OListViewItem::serializeTo( QDataStream& s ) const -{ - #warning Caution... the binary format is still under construction... - qDebug( "storing OListViewItem..." ); - - // store item text - for ( int i = 0; i < listView()->columns(); ++i ) - { - s << text( i ); - } - - // calculate the number of children to serialize - int items = 0; - QListViewItem* item = firstChild(); - while ( item ) - { - item = item->nextSibling(); - items++; - } - - // store number of items and the items itself - s << items; - item = firstChild(); - for ( int i = 0; i < items; ++i ) - { - s << *static_cast( item ); - item = item->nextSibling(); - } - - qDebug( "OListviewItem stored." ); -} -void OListViewItem::serializeFrom( QDataStream& s ) -{ - #warning Caution... the binary format is still under construction... - qDebug( "loading OListViewItem..." ); - - for ( int i = 0; i < listView()->columns(); ++i ) - { - QString coltext; - s >> coltext; - qDebug( "read text '%s' for column %d", (const char*) coltext, i ); - setText( i, coltext ); - } - - int items; - s >> items; - qDebug( "read number of items = %d", items ); - - for ( int i = 0; i < items; ++i ) - { - OListViewItem* item = childFactory(); - s >> (*item); - } - - qDebug( "OListViewItem loaded." ); -} - -QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) -{ - lvi.serializeTo( s ); -} - -QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) -{ - lvi.serializeFrom( s ); -} -#endif // QT_NO_DATASTREAM diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h deleted file mode 100644 index 8911e22..0000000 --- a/noncore/net/wellenreiter/cornucopia/olistview.h +++ b/dev/null @@ -1,237 +0,0 @@ -/* -                 This file is part of the Opie Project - -              Copyright (C) 2003 Michael 'Mickey' Lauer - - =. - .=l. -           .>+-= - _;:,     .>    :=|. This program is free software; you can -.> <`_,   >  .   <= redistribute it and/or modify it under -:`=1 )Y*s>-.--   : the terms of the GNU Library General Public -.="- .-=="i,     .._ License as published by the Free Software - - .   .-<_>     .<> Foundation; either version 2 of the License, -     ._= =}       : or (at your option) any later version. -    .%`+i>       _;_. -    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU -..}^=.=       =       ; Library General Public License for more -++=   -.     .`     .: details. - :     =  ...= . :.=- - -.   .:....=;==+<; You should have received a copy of the GNU -  -_. . .   )=.  = Library General Public License along with -    --        :-=` this library; see the file COPYING.LIB. - If not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - -*/ - -#ifndef OLISTVIEW_H -#define OLISTVIEW_H - -#include -#include -#include -#include - -class OListViewItem; - -/** - * A @ref QListView variant featuring visual and functional enhancements - * like an alternate background for odd rows, an autostretch mode - * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. - * - * @author Michael 'Mickey' Lauer - * @short OListView list/tree widget. - */ - class OListView: public QListView -{ - public: - /** - * Constructor. - * - * The parameters @p parent and @p name are handled by - * @ref QListView, as usual. - */ - OListView ( QWidget *parent = 0, const char *name = 0 ); - - /** - * Destructor. - */ - virtual ~OListView(); - - /** - * Let the last column fit exactly all the available width. - */ - void setFullWidth( bool fullWidth ); - - /** - * Returns whether the last column is set to fit the available width. - */ - bool fullWidth() const; - - /** - * Reimplemented for full width support - */ - virtual int addColumn( const QString& label, int width = -1 ); - - /** - * Reimplemented for full width support - */ - virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); - - /** - * Reimplemented for full width support - */ - virtual void removeColumn(int index); - - /** - * sets the alternate background background color. - * This only has an effect if the items are OListViewItems - * - * @param c the color to use for every other item. Set to an invalid - * color to disable alternate colors. - */ - void setAlternateBackground( const QColor &c ); - - /** - * sets the column separator pen. - * - * @param p the pen used to draw the column separator. - */ - void setColumnSeparator( const QPen &p ); - - /** - * @return the alternate background color - */ - const QColor& alternateBackground() const; - - /** - * @return the column separator pen - */ - const QPen& columnSeparator() const; - - /** - * create a list view item as child of this object - * @return the new object - */ - virtual OListViewItem* childFactory(); - - #ifndef QT_NO_DATASTREAM - /** - * serialize this object to a @ref QDataStream - * @param s the stream used to serialize this object. - */ - virtual void serializeTo( QDataStream& s ) const; - - /** - * serialize this object from a @ref QDataStream - * @param s the stream used to serialize this object. - */ - virtual void serializeFrom( QDataStream& s ); - #endif - - private: - QColor m_alternateBackground; - bool m_fullWidth; - QPen m_columnSeparator; -}; - -#ifndef QT_NO_DATASTREAM -/** - * \relates QListView - * Writes a listview to the stream and returns a reference to the stream. - */ -QDataStream& operator<<( QDataStream& s, const OListView& lv ); -/** - * \relates QListView - * Reads a listview from the stream and returns a reference to the stream. - */ -QDataStream& operator>>( QDataStream& s, OListView& lv ); -#endif // QT_NO_DATASTREAM - -//****************************** OListViewItem ****************************************************************** - -class OListViewItem: public QListViewItem -{ - public: - OListViewItem( QListView * parent ); - OListViewItem( QListViewItem * parent ); - OListViewItem( QListView * parent, QListViewItem * after ); - OListViewItem( QListViewItem * parent, QListViewItem * after ); - - OListViewItem( QListView * parent, - QString, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null ); - - OListViewItem( QListViewItem * parent, - QString, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null ); - - OListViewItem( QListView * parent, QListViewItem * after, - QString, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null ); - - OListViewItem( QListViewItem * parent, QListViewItem * after, - QString, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null, - QString = QString::null, QString = QString::null ); - - virtual ~OListViewItem(); - - const QColor& backgroundColor(); - bool isAlternate(); - void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); - void init(); - - /** - * create a list view item as child of this object - * @return the new object - */ - virtual OListViewItem* childFactory(); - - #ifndef QT_NO_DATASTREAM - /** - * serialize this object to or from a @ref QDataStream - * @param s the stream used to serialize this object. - */ - virtual void serializeTo( QDataStream& s ) const; - - /** - * serialize this object to or from a @ref QDataStream - * @param s the stream used to serialize this object. - */ - virtual void serializeFrom( QDataStream& s ); - #endif - - private: - bool m_known; - bool m_odd; -}; - -#ifndef QT_NO_DATASTREAM -/** - * \relates QListViewItem - * Writes a listview item and all subitems recursively to the stream - * and returns a reference to the stream. - */ -QDataStream& operator<<( QDataStream &s, const OListViewItem& lvi ); -/** - * \relates QListViewItem - * Reads a listview item from the stream and returns a reference to the stream. - */ -QDataStream& operator>>( QDataStream &s, OListViewItem& lvi ); -#endif // QT_NO_DATASTREAM - -#endif // OLISTVIEW_H diff --git a/noncore/net/wellenreiter/daemon/.cvsignore b/noncore/net/wellenreiter/daemon/.cvsignore deleted file mode 100644 index 4299fd9..0000000 --- a/noncore/net/wellenreiter/daemon/.cvsignore +++ b/dev/null @@ -1,4 +0,0 @@ -*.o -*~ -moc_* -Makefile* diff --git a/noncore/net/wellenreiter/daemon/daemon.pro b/noncore/net/wellenreiter/daemon/daemon.pro deleted file mode 100644 index 33a6bb9..0000000 --- a/noncore/net/wellenreiter/daemon/daemon.pro +++ b/dev/null @@ -1,16 +0,0 @@ -DESTDIR = $(OPIEDIR)/bin -TEMPLATE = app -CONFIG = warn_on debug -#CONFIG = warn_on release -HEADERS = source/config.hh source/daemon.hh -SOURCES = source/daemon.cc -INCLUDEPATH += ../ -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lpcap -lpthread -L$(OPIEDIR)/lib -lwellenreiter -INTERFACES = -TARGET = wellenreiterd -DEFINES += DEBUG - -!contains( platform, x11 ) { - include ( $(OPIEDIR)/include.pro ) -} diff --git a/noncore/net/wellenreiter/daemon/source/.cvsignore b/noncore/net/wellenreiter/daemon/source/.cvsignore deleted file mode 100644 index ed65c71..0000000 --- a/noncore/net/wellenreiter/daemon/source/.cvsignore +++ b/dev/null @@ -1,3 +0,0 @@ -*.o -*~ -moc_* diff --git a/noncore/net/wellenreiter/daemon/source/Makefile b/noncore/net/wellenreiter/daemon/source/Makefile deleted file mode 100644 index 38d61f1..0000000 --- a/noncore/net/wellenreiter/daemon/source/Makefile +++ b/dev/null @@ -1,25 +0,0 @@ -# $Id$ - -CPP = g++ -CPPFLAGS = -g -Wall -pedantic -DDEBUG -I ../../ -LIBS = -lpthread -lpcap ../../libwellenreiter/source/libwellenreiter.a -OBJ = daemon.o - -.SUFFIXES: -.PHONY: all wellenreiterd clean distclean realclean - -%.o : %.cc - $(CPP) $(CPPFLAGS) -c $< -o $@ - -all: wellenreiterd - -wellenreiterd: $(OBJ) - $(CPP) $(CPPFLAGS) $(OBJ) $(LIBS) -o $@ - @echo Build wellenreiterd - -clean distclean realclean: - @rm -f wellenreiterd *~ *.o - @echo All dependent files have been removed. - -daemon.o: config.hh - diff --git a/noncore/net/wellenreiter/daemon/source/config.hh b/noncore/net/wellenreiter/daemon/source/config.hh deleted file mode 100644 index 0ac7eb9..0000000 --- a/noncore/net/wellenreiter/daemon/source/config.hh +++ b/dev/null @@ -1,29 +0,0 @@ -/* - * - * Global configuration for wellenreiter - * - * $Id$ - * - * Written by Martin J. Muench - * - */ - -#ifndef CONFIG_HH -#define CONFIG_HH - -#define PROGNAME "wellenreiter" /* Name of program (for syslog et.al.) */ -#define VERSION "0.2" /* Version of wellenreiter */ - -#define DAEMONADDR "127.0.0.1" -#define DAEMONPORT 37772 /* Port of Daemon */ - -#define GUIADDR "127.0.0.1" /* Adress of GUI, later specified in configfile */ -#define GUIPORT 37773 /* Port of GUI, " " */ - -/* Temporary cardmode stuff, will hopefully removed soon */ -#define CARD_TYPE_CISCO 1 -#define CARD_TYPE_NG 2 -#define CARD_TYPE_HOSTAP 3 -#define CARD_TYPE_ORINOCCO 4 - -#endif /* CONFIG_HH */ diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc deleted file mode 100644 index b840f17..0000000 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/dev/null @@ -1,195 +0,0 @@ -/* - * Startup functions of wellenreiter - * - * $Id$ - */ - -#include "config.hh" -#include "daemon.hh" - -/* should be parsed from cfg-file */ -#define MAXCHANNEL 13 -#define CHANINTERVAL 500000 - - -/* Main function of wellenreiterd */ -int main(int argc, char **argv) -{ - int sock, maxfd, retval; - char buffer[WL_SOCKBUF]; - struct pcap_pkthdr header; - struct sockaddr_in saddr; -// pcap_t *handletopcap; - wl_cardtype_t cardtype; - pthread_t sub; - const unsigned char *packet; - - fd_set rset; - - fprintf(stderr, "wellenreiterd %s\n\n", VERSION); - fprintf(stderr, "(c) 2002 by M-M-M\n\n"); - - if(argc < 3) - usage(); - - /* Set sniffer device */ - memset(cardtype.iface, 0, sizeof(cardtype.iface)); - strncpy(cardtype.iface, (char *)argv[1], sizeof(cardtype.iface) - 1); - - /* Set card type */ - cardtype.type = atoi(argv[2]); - if(cardtype.type < 1 || cardtype.type > 4) - usage(); - - /* Until we do not act as a read daemon, it starts the sniffer - right after startup */ - if (!start_sniffer(cardtype.iface,cardtype.type)) - { - wl_logerr("daemon, start_sniff did not return proper, aborting"); - exit(EXIT_FAILURE); - } - wl_loginfo ("daemon, wireless card prepared for sniffing"); - - /* Setup socket for incoming commands */ - if((sock=wl_setupsock(DAEMONADDR, DAEMONPORT, saddr)) < 0) - { - wl_logerr("Cannot setup socket"); - exit(EXIT_FAILURE); - } - wl_loginfo("Set up socket '%d' for GUI communication", sock); - - /* Create channelswitching thread */ - if(pthread_create(&sub, NULL, channel_switcher, - (void *)&cardtype) != 0) - { - wl_logerr("Cannot create thread: %s", strerror(errno)); - close(sock); - exit(EXIT_FAILURE); - } - if(pthread_detach(sub)) - { - wl_logerr("Error detaching thread"); - close(sock); - pthread_exit((pthread_t *)sub); - exit(EXIT_FAILURE); - } - wl_loginfo("Created and detached channel switching thread"); - - FD_ZERO(&rset); - - /* Start main loop */ - wl_loginfo("Starting main loop"); - while(1) - { - - FD_SET(sock, &rset); - FD_SET(pcap_fileno(handletopcap), &rset); - - /* maxfd = biggest filefd */ - maxfd = (sock > pcap_fileno(handletopcap) ? - sock + 1 : pcap_fileno(handletopcap)) + 1; - - if(select(maxfd, &rset, NULL, NULL, NULL) < 0) - { - wl_logerr("Error calling select: %s", strerror(errno)); - break; - } - - /* Got data on local socket from GUI */ - if(FD_ISSET(sock, &rset)) - { - /* Receive data from socket */ - if((retval=wl_recv(&sock, saddr, buffer, sizeof(buffer))) < 0) - { - wl_logerr("Error trying to read: %s", strerror(errno)); - break; - } - else - { - /* check type of packet and start function according to it */ - switch(retval) - { - case STARTSNIFF: - wl_loginfo("Received STARTSNIFF command"); - if(!send_ok(GUIADDR, GUIPORT, STARTSNIFF)) - wl_logerr("Cannot set OK_CMD to GUI"); - break; - case STOPSNIFF: - wl_loginfo("Received STOPSNIFF command"); - if(!send_ok(GUIADDR, GUIPORT, STOPSNIFF)) - wl_logerr("Cannot set FAIL_CMD to GUI"); - break; - default: - wl_logerr("Received unknown command: %d", retval); - break; - } - } - } /* FD_ISSET */ - - /* Check pcap lib for packets */ - if(FD_ISSET(pcap_fileno(handletopcap), &rset)) - { - - /* Grab one single packet */ - packet = pcap_next(handletopcap, &header); - - /* process the packet */ - process_packets(&header,*&packet, GUIADDR, GUIPORT); - } - - } /* while(1) */ - - close(sock); - exit(EXIT_SUCCESS); -} - -void -usage(void) -{ - fprintf(stderr, "Usage: wellenreiter \n" \ - "\t = Wirelessdevice (e.g. wlan0)\n" \ - "\t = Cardtype:\tCisco\t= 1\n" \ - "\t\t\t\tNG\t= 2\n" \ - "\t\t\t\tHOSTAP\t= 3\n" \ - "\t\t\t\tLUCENT\t= 4\n"); - exit(EXIT_FAILURE); -} - -void * -channel_switcher(void *cardtypeptr) -{ - wl_cardtype_t *cardtype; - int maxchan=0; - int channel=1; - /* Get card info struct */ - cardtype = (wl_cardtype_t *)cardtypeptr; - /* Get from the wireless extension the amount of available channels - this prevents a fail in switching on us cards */ - maxchan = card_detect_channels(cardtype->iface); - - if (maxchan < MAXCHANNEL) - { - #undef MAXCHANNEL - #define MAXCHANNEL maxchan - } - - while(1) - { - - /* If channel bigger than maxchannel, set to 1 */ - if(channel > MAXCHANNEL) - channel=1; - - /* Set channel */ - if(!card_set_channel(cardtype->iface, channel, cardtype->type)) - { - wl_logerr("Cannot set channel, thread exiting"); - pthread_exit(NULL); - } - - /* sleep */ - usleep(CHANINTERVAL); - - channel++; - } /* while */ -} diff --git a/noncore/net/wellenreiter/daemon/source/daemon.hh b/noncore/net/wellenreiter/daemon/source/daemon.hh deleted file mode 100644 index f9ac45e..0000000 --- a/noncore/net/wellenreiter/daemon/source/daemon.hh +++ b/dev/null @@ -1,27 +0,0 @@ -/* $Id$ */ - -#ifndef DAEMON_HH -#define DAEMON_HH - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -void usage(void); -void *channel_switcher(void *); - -#endif /* DAEMON_HH */ diff --git a/noncore/net/wellenreiter/docs/specification b/noncore/net/wellenreiter/docs/specification deleted file mode 100644 index 0766ef4..0000000 --- a/noncore/net/wellenreiter/docs/specification +++ b/dev/null @@ -1,140 +0,0 @@ - --[ Design of wellenreiter ]- - -written by: Martin J. Muench - --[ Introduction - -This is just a short overview of the new design of wellenreiter. -There will for sure be some changes and most parts will be specified -in more detail. - - --[ Program - -wellenreiter 1.7 -(will be named 2.0 after all the functions are implemented and the code -is cleaned up and audited) - - --[ Short description - -Wellenreiter is a wireless sniffing tool like netstumbler, kismet et al. -It discovers Access Points and Ad-Hoc networks and displays all available -information about them so that you can simply join unencrypted network -(without access restrictions) with the given informations. -For the latest version of wellenreiter look at: -http://wellenreiter.sourceforge.net. - - --[ Overview - -The software is divided into 2 sections, the daemon and the GUI. -The daemon does the active sniffing, analying stuff etc.pp. and -sends the informations to the GUI which displays the results. - - --[ Configuration - -The configuration is done by both, the GUI and the daemon so that the -GUI only provides the graphical interface to the configuration library -of the daemon. That means that the daemon loads the config file on -startup and sends the informations to the GUI. The GUI contains an option -"configure" where the settings can be changed. They will be sent to the -daemon which actually changes the configuration file. -The configuration file is placed in /usr/local/etc/wellenreiter.conf. -The whole content of this file cannot be specified yet. - -OPIE specific: Opie contains a bunch of high-level configuration classes, -which are used by most Opie applications. It should be discussed whether -to use this structure / API (preferred) or use a proprietary one. - - --[ Interaction GUI<->daemon - -The GUI and the daemon will talk actively with eachother, meaning that -everyside who has informations for the other part will send it and not -wait for the other part to poll. -For example the sniffing function of the daemon is startet when a -"start_sniff" from the GUI arrived. And when the daemon found a network -it will be directly send to the GUI to be able to sniff in realtime. - - --[ Communication GUI<->daemon - -The GUI and the daemon run as threads within one process, where the GUI -thread will be the main thread. Both the daemon and the GUI thread are -(mostly) "free-running". Once the GUI thread is started and has finished -its initializations, it jumps into the Qt event loop ( QApplication::exec() ). - -If the daemon thread is actively working and - -for instance - has acquired interesting data for the GUI thread to display, -it calls a special reentrant method of the GUI thread ( QApplication::postEvent ) -either transmitting the whole data structure or saying "Hey, there's interesting data -for you", which the GUI thread then retrieves. -To enable a free running daemon thread to actually receive messages from the -GUI thread, it's useful to to include a non-blocking check-for-messages-function -within the daemon main loop . If applicable, the daemon thread must -not call this function but only monitor some guarded variables from time to time -which the GUI thread can modify to alter the behaviour of the daemon thread. - -IMHO this is a much more leightweight design than to use a proprietary udp-socket protocol. - - --[ Setting card modes - -One of the most interesting parts is the switching of the wirelesscards to -different channels, to monitor mode and so on. In the older versions this -actions were done by the calling of external programs, that is now obsolete. -We will use the API of the wireless drivers to set it up. - - --[ Sniffing - -The sniffing will be done by capturing and analyzing all packets using the -pcap library. The sniffer itself will be a function of the daemon which will -probably be threaded so that this function is non-blocking. -If a packet is found the sniffer sends it to an analyzer function which -analyzes the packets, strips the results and sends it to the GUI. - - --[ Logging - -The GUI should not need to log that much so it logs to STDERR. The daemon -will be able to run in foreground and log to STDERR and syslog but normally -it will only log to syslog (INFO/ERR). -Logging of found networks, packets and so on will also be done by the daemon -but set up by the GUI. - - --[ GPS - -The gps daemon software will be used, hopefully by their API if they provide -that. If not, we have to use system() calls, hope we do not. - - --[ Security - -The programm and the daemon will have to run with SUID privileges for being -able to change card modes etc. so the code has to be audited several times. -Setuid 0 will only be called when really needing the privileges and dropped -directly after every single systemcall. -The daemon will implement an access control list where it specifies which -IPs or network interfaces will have access to it. -The configuration file will be chmod'ed 0400, for writing the configuration -library will change the mode. Of course the file will be locked during -writing so no race conditions can occur. - - --[ Documentation - -Wellenreiter will have it's own wellenreiter(8) manpage with most parts of -the README file in there. -Also we will provide general documentation about wireless scanning, security -risks with wireless devices and so on. -Most documentation will be intern like this one. The GUI and the daemon -should have a non-technical documentation and a developers version so we -can easily develope with other peoples code without having to read it -completely. - diff --git a/noncore/net/wellenreiter/gui/cardconfig.cpp b/noncore/net/wellenreiter/gui/cardconfig.cpp deleted file mode 100644 index 1ca1d27..0000000 --- a/noncore/net/wellenreiter/gui/cardconfig.cpp +++ b/dev/null @@ -1,29 +0,0 @@ -/********************************************************************** -** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. -** -** This file is part of Opie Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -**********************************************************************/ - -#include "cardconfig.h" - -#include - -CardConfig::CardConfig( const QString& interface, Type type, int hopinterval ) - :_interface( interface ), _type( type ), _hopinterval( hopinterval ) -{ - -} - -CardConfig::~CardConfig() -{ -} - diff --git a/noncore/net/wellenreiter/gui/cardconfig.h b/noncore/net/wellenreiter/gui/cardconfig.h deleted file mode 100644 index f54ebac..0000000 --- a/noncore/net/wellenreiter/gui/cardconfig.h +++ b/dev/null @@ -1,58 +0,0 @@ -/********************************************************************** -** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. -** -** This file is part of Opie Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -**********************************************************************/ - -#ifndef CARDCONFIG_H -#define CARDCONFIG_H - -#include - -#ifdef QWS -#include -using namespace Opie; -#endif - -class CardConfig -{ - public: - - typedef enum { Prism, Orinoco, HostAP, Manual } Type; - - public: - - CardConfig( const QString& interface, Type type = Manual, int hopinterval = 100 ); - virtual ~CardConfig(); - - const QString& interface() { return _interface; }; - int hopinterval() { return _hopinterval; }; - Type type() { return _type; }; - - #ifdef QWS - OSystem system() { return _system; }; - #endif - - private: - - QString _interface; - Type _type; - int _hopinterval; - - #ifdef QWS - OSystem _system; - #endif - -}; - -#endif - diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 398118f..fa727f9 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -11,7 +11,7 @@ 0 0 - 220 + 212 267 @@ -103,48 +103,6 @@ QComboBox - - - text - <select> - - - - - text - eth0 - - - - - text - eth1 - - - - - text - wlan0 - - - - - text - wlan1 - - - - - text - wifi0 - - - - - text - wifi1 - - name interfaceName @@ -421,6 +379,10 @@ beepOnFound + enabled + false + + text Beep on new network diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index f86b109..6dd862f 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -13,13 +13,19 @@ ** **********************************************************************/ +/* LOCAL */ #include "configwindow.h" + +/* QT */ #include #include #include #include #include +/* OPIE */ +#include + WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, true, f ) { @@ -29,6 +35,16 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char _devicetype[ "orinoco" ] = 4; _devicetype[ "" ] = 5; + // gather possible interface names from ONetwork + ONetwork* net = ONetwork::instance(); + ONetwork::InterfaceIterator it = net->iterator(); + while ( it.current() ) + { + if ( it.current()->isWireless() ) + interfaceName->insertItem( it.current()->name() ); + ++it; + } + #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here QPushButton* okButton = new QPushButton( "ok", this ); okButton->show(); diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 8861a50..200bfc1 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro @@ -11,8 +11,6 @@ HEADERS = wellenreiterbase.h \ logwindow.h \ hexwindow.h \ configwindow.h \ - wlan.h \ - cardconfig.h \ manufacturers.h SOURCES = main.cpp \ @@ -23,13 +21,11 @@ SOURCES = main.cpp \ logwindow.cpp \ hexwindow.cpp \ configwindow.cpp \ - wlan.cpp \ - cardconfig.cpp \ manufacturers.cpp -INCLUDEPATH += $(OPIEDIR)/include ../ -DEPENDPATH += $(OPIEDIR)/include ../ -LIBS += -L. -lwellenreiter -lcornucopia +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -L. -lwellenreiter -lopiecore2 -lopieui2 -lopienet2 INTERFACES = configbase.ui TARGET = wellenreiter diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 270ce06..96a8c1c 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp @@ -14,30 +14,14 @@ **********************************************************************/ #include "mainwindow.h" - -#ifdef QWS -#include -#else -#include -#endif +#include int main( int argc, char **argv ) { -#ifdef QWS - QPEApplication a( argc, argv ); -#else - QApplication a( argc, argv ); -#endif - - WellenreiterMainWindow w; - - w.setCaption( "Wellenreiter/Opie" ); -#ifdef QWS - a.showMainWidget(&w); -#else - a.setMainWidget(&w); - w.show(); -#endif - - return a.exec(); + OApplication a( argc, argv, "Wellenreiter II" ); + WellenreiterMainWindow* w = new WellenreiterMainWindow(); + a.showMainWidget( w ); + a.exec(); + delete w; + return 0; } diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 222217c..da9369f 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -16,7 +16,7 @@ #ifndef SCANLIST_H #define SCANLIST_H -#include +#include #include diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 09a44e6..5bdc1b3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -21,13 +21,6 @@ #include #include -// Qtopia - -#ifdef QWS -#include -#include -#endif - // Opie #ifdef QWS @@ -35,6 +28,10 @@ using namespace Opie; #endif +#include +#include +#include + // Standard #include @@ -42,9 +39,7 @@ using namespace Opie; #include #include #include -#include #include -#include // Local @@ -56,14 +51,9 @@ using namespace Opie; #include "manufacturers.h" -#include -#include -#include -#include - Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), - daemonRunning( false ), manufacturerdb( 0 ), configwindow( 0 ) + sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) { // @@ -91,31 +81,14 @@ Wellenreiter::Wellenreiter( QWidget* parent ) logwindow->log( sys ); #endif - // - // setup socket for daemon communication, register socket notifier - // - - // struct sockaddr_in sockaddr; - daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr ); - if ( daemon_fd == -1 ) - { - logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); - } - else - { - int flags; - flags = fcntl( daemon_fd, F_GETFL, 0 ); - fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); - QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, this ); - connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); - } - // setup GUI netview->setColumnWidthMode( 1, QListView::Manual ); if ( manufacturerdb ) netview->setManufacturerDB( manufacturerdb ); + pcap = new OPacketCapturer(); + } Wellenreiter::~Wellenreiter() @@ -123,14 +96,7 @@ Wellenreiter::~Wellenreiter() // no need to delete child widgets, Qt does it all for us delete manufacturerdb; - - if ( daemon_fd != -1 ) - { - qDebug( "closing comm socket" ); - ::shutdown( daemon_fd, 0 ); - ::close( daemon_fd ); - qDebug( "comm socket closed." ); - } + delete pcap; } void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) @@ -138,145 +104,125 @@ void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) configwindow = cw; } -void Wellenreiter::handleMessage() +void Wellenreiter::receivePacket(OPacket* p) { - // FIXME: receive message and handle it - - qDebug( "received message from daemon." ); - - /*char buffer[10000]; - memset( &buffer, 0, sizeof( buffer ) );*/ - - char buffer[WL_SOCKBUF]; - - // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); - - /* - - struct sockaddr from; - socklen_t len; - - int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); - qDebug( "received %d from recv [%d bytes]", result, len ); - - */ - - int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); - - if ( result == -1 ) - { - qDebug( "Warning: %s", strerror( errno ) ); - return; - } - - int command = buffer[1] - 48; - -/* -typedef struct { - int net_type; 1 = Accesspoint ; 2 = Ad-Hoc - int ssid_len; Length of SSID - int channel; Channel - int wep; 1 = WEP enabled ; 0 = disabled - char mac[64]; MAC address of Accesspoint - char bssid[128]; BSSID of Accesspoint -} wl_network_t; -*/ - - qDebug( "Recv result: %d", ( result ) ); - qDebug( "Sniffer sent: '%s'", (const char*) buffer ); - hexwindow->log( (const char*) &buffer ); - - if ( command == NETFOUND ) /* new network found */ - { - qDebug( "Sniffer said: new network found." ); - wl_network_t n; - get_network_found( &n, (char*) &buffer ); - - qDebug( "Sniffer said: net_type is %d.", n.net_type ); - qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); - - //n.bssid[n.ssid_len] = "\0"; - - QString type; - - if ( n.net_type == 1 ) - type = "managed"; - else - type = "adhoc"; + logwindow->log( "(d) Received data from daemon" ); + //TODO - netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); + // check if we received a beacon frame + // static_cast is justified here + OWaveLanManagementPacket* beacon = static_cast( p->child( "802.11 Management" ) ); + if ( !beacon ) return; + QString type; - } + //FIXME: Can stations in ESS mode can be distinguished from APs? + //FIXME: Apparently yes, but not by listening to beacons, because + //FIXME: they simply don't send beacons in infrastructure mode. + //FIXME: so we also have to listen to data packets + if ( beacon->canIBSS() ) + type = "adhoc"; else + type = "managed"; - { - qDebug( "unknown sniffer command." ); - } + OWaveLanManagementSSID* ssid = static_cast( p->child( "802.11 SSID" ) ); + QString essid = ssid ? ssid->ID() : ""; + OWaveLanManagementDS* ds = static_cast( p->child( "802.11 DS" ) ); + int channel = ds ? ds->channel() : -1; -} - -void Wellenreiter::dataReceived() -{ - logwindow->log( "(d) Received data from daemon" ); - handleMessage(); + OWaveLanPacket* header = static_cast( p->child( "802.11" ) ); + netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 ); } void Wellenreiter::startStopClicked() { - if ( daemonRunning ) + if ( sniffing ) { - daemonRunning = false; + disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); - logwindow->log( "(i) Daemon has been stopped." ); - setCaption( tr( "Wellenreiter/Opie" ) ); + iface->setChannelHopping(); // stop hopping channels + pcap->close(); + sniffing = false; + oApp->setTitle(); - // Stop daemon - ugly for now... later better + // get interface name from config window + const QString& interface = configwindow->interfaceName->currentText(); + ONetwork* net = ONetwork::instance(); + iface = static_cast(net->interface( interface )); - system( "killall wellenreiterd" ); + // switch off monitor mode + iface->setMonitorMode( false ); + // switch off promisc flag + iface->setPromiscuousMode( false ); - // get configuration from config window + //TODO: Display "please wait..." (use owait?) - const QString& interface = configwindow->interfaceName->currentText(); - - // reset the interface trying to get it into a usable state again + /* QString cmdline; - cmdline.sprintf( "iwpriv %s monitor 0; ifdown %s; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface ); - system( cmdline ); + cmdline.sprintf( "ifdown %s; sleep 1; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface ); + system( cmdline ); //FIXME: Use OProcess + + */ // message the user - QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." ); + //QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); } else { - // get configuration from config window const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->daemonDeviceType(); const int interval = configwindow->daemonHopInterval(); - if ( ( interface == "