summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp63
-rw-r--r--libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp1
-rw-r--r--libopie2/libopie2.control6
-rw-r--r--libopie2/opienet/omanufacturerdb.cpp96
-rw-r--r--libopie2/opienet/omanufacturerdb.h37
-rw-r--r--libopie2/opienet/onetutils.cpp21
-rw-r--r--libopie2/opienet/onetutils.h3
-rw-r--r--libopie2/opienet/opcap.cpp8
-rw-r--r--libopie2/opienet/opienet.pro12
9 files changed, 205 insertions, 42 deletions
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
index 7581888..f800336 100644
--- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
+++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
@@ -85,25 +85,2 @@ public:
- /*
-
- // ifconfig down the interface - this enable more crash-proof
- // scanning with drivers like spectrum_cs...
- if ( wiface->isUp() )
- {
- printf( "Interface status is up... switching to down... " );
- wiface->setUp( false );
- if ( wiface->isUp() )
- {
- printf( "failed (%s). Exiting.\n", strerror( errno ) );
- exit( -1 );
- }
- else
- {
- printf( "ok.\n" );
- }
- }
- else
- printf( "Interface status is already down - good.\n" );
-
- */
-
// ifconfig +promisc the interface to receive all packets
@@ -171,3 +148,2 @@ public slots:
OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" );
-
if ( beacon )
@@ -185,2 +161,41 @@ public slots:
}
+ return;
+ }
+
+ OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" );
+ if ( data )
+ {
+ OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
+ if ( wlan->fromDS() && !wlan->toDS() )
+ {
+ printf( "FromDS: '%s' -> '%s' via '%s'\n",
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress2().toString(true) );
+ }
+ else
+ if ( !wlan->fromDS() && wlan->toDS() )
+ {
+ printf( "ToDS: '%s' -> '%s' via '%s'\n",
+ (const char*) wlan->macAddress2().toString(true),
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true) );
+ }
+ else
+ if ( wlan->fromDS() && wlan->toDS() )
+ {
+ printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n",
+ (const char*) wlan->macAddress4().toString(true),
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress2().toString(true) );
+ }
+ else
+ {
+ printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n",
+ (const char*) wlan->macAddress2().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress3().toString(true) );
+ }
+ return;
}
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
index 020fc23..f801b15 100644
--- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
+++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -14,2 +14,3 @@ int main( int argc, char** argv )
qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() );
+ qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) );
qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() );
diff --git a/libopie2/libopie2.control b/libopie2/libopie2.control
index 24a7c37..866d106 100644
--- a/libopie2/libopie2.control
+++ b/libopie2/libopie2.control
@@ -1,2 +1,2 @@
-Files: $OPIEDIR/lib/libopiecore2.so.1.8.1 $OPIEDIR/lib/libopiecore2.so.1.8 $OPIEDIR/lib/libopiecore2.so.1 $OPIEDIR/lib/libopienet2.so.1.8.1 $OPIEDIR/lib/libopienet2.so.1.8 $OPIEDIR/lib/libopienet2.so.1 $OPIEDIR/lib/libopieui2.so.1.8.1 $OPIEDIR/lib/libopieui2.so.1.8 $OPIEDIR/lib/libopieui2.so.1
+Files: $OPIEDIR/lib/libopiecore2.so.1.8.1 $OPIEDIR/lib/libopiecore2.so.1.8 $OPIEDIR/lib/libopiecore2.so.1 $OPIEDIR/lib/libopienet2.so.1.8.1 $OPIEDIR/lib/libopienet2.so.1.8 $OPIEDIR/lib/libopienet2.so.1 $OPIEDIR/lib/libopieui2.so.1.8.1 $OPIEDIR/lib/libopieui2.so.1.8 $OPIEDIR/lib/libopieui2.so.1 $OPIEDIR/etc/manufacturers
Priority: optional
@@ -5,6 +5,6 @@ Maintainer: Opie Team <opie@handhelds.org>
Architecture: arm
-Version: 1.8.1-$SUB_VERSION.1
+Version: 1.8.1-$SUB_VERSION.2
Depends: libqpe1
Provides: libopie2
-Replaces: libopie2
Description: Opie library 2.0
+
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp
new file mode 100644
index 0000000..ea15125
--- a/dev/null
+++ b/libopie2/opienet/omanufacturerdb.cpp
@@ -0,0 +1,96 @@
+/**********************************************************************
+** 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 "omanufacturerdb.h"
+
+// Qt
+#include <qstring.h>
+#include <qfile.h>
+#include <qtextstream.h>
+
+OManufacturerDB* OManufacturerDB::_instance = 0;
+
+OManufacturerDB* OManufacturerDB::instance()
+{
+ if ( !OManufacturerDB::_instance )
+ {
+ qDebug( "OManufacturerDB::instance(): creating OManufacturerDB..." );
+ _instance = new OManufacturerDB();
+ }
+ return _instance;
+}
+
+
+OManufacturerDB::OManufacturerDB()
+{
+ QString filename( "/etc/manufacturers" );
+ qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename );
+ if ( !QFile::exists( filename ) )
+ {
+ filename = "/opt/QtPalmtop/etc/manufacturers";
+ qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename );
+ if ( !QFile::exists( filename ) )
+ {
+ filename = "/usr/share/wellenreiter/manufacturers";
+ qDebug( "OManufacturerDB: trying to read '%s'...", (const char*) filename );
+ }
+ }
+
+ QFile file( filename );
+ bool hasFile = file.open( IO_ReadOnly );
+ if (!hasFile)
+ {
+ qWarning( "OManufacturerDB: no valid manufacturer list found.", (const char*) filename );
+ }
+ else
+ {
+ qDebug( "OManufacturerDB: found manufacturer list in '%s'...", (const char*) filename );
+ QTextStream s( &file );
+ QString addr;
+ QString manu;
+ while (!s.atEnd())
+ {
+ s >> addr;
+ if ( !addr ) // read nothing!?
+ {
+ continue;
+ }
+ else
+ if ( addr[0] == '#' )
+ {
+ s.readLine();
+ continue;
+ }
+ s.skipWhiteSpace();
+ s >> manu;
+ s.readLine();
+ //qDebug( "ManufacturerDB: read pair %s, %s", (const char*) addr, (const char*) manu );
+ manufacturers.insert( addr, manu );
+
+ }
+ }
+
+}
+
+
+OManufacturerDB::~OManufacturerDB()
+{
+}
+
+
+const QString& OManufacturerDB::lookup( const QString& macaddr ) const
+{
+ return manufacturers[macaddr.upper().left(8)];
+}
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h
new file mode 100644
index 0000000..5e66c37
--- a/dev/null
+++ b/libopie2/opienet/omanufacturerdb.h
@@ -0,0 +1,37 @@
+/**********************************************************************
+** 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 OMANUFACTURERDB_H
+#define OMANUFACTURERDB_H
+
+#include <qmap.h>
+
+class OManufacturerDB
+{
+ public:
+ static OManufacturerDB* instance();
+ const QString& lookup( const QString& macaddr ) const;
+
+ protected:
+ OManufacturerDB();
+ virtual ~OManufacturerDB();
+
+ private:
+ QMap<QString, QString> manufacturers;
+ static OManufacturerDB* _instance;
+};
+
+#endif
+
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp
index 2485f30..236f108 100644
--- a/libopie2/opienet/onetutils.cpp
+++ b/libopie2/opienet/onetutils.cpp
@@ -33,2 +33,3 @@
#include <opie2/onetwork.h>
+#include <opie2/omanufacturerdb.h>
@@ -111,9 +112,12 @@ OMacAddress OMacAddress::fromString( const QString& str )
-QString OMacAddress::toString() const
+QString OMacAddress::toString( bool substitute ) const
{
- QString s;
- s.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
- _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff,
- _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff );
- return s;
+ QString manu;
+ manu.sprintf( "%.2X:%.2X:%.2X", _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff );
+ QString serial;
+ serial.sprintf( ":%.2X:%.2X:%.2X", _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff );
+ if ( !substitute ) return manu+serial;
+ // fallback - if no vendor is found, just use the number
+ QString textmanu = OManufacturerDB::instance()->lookup( manu );
+ return textmanu.isNull() ? manu+serial : textmanu + serial;
}
@@ -121,2 +125,7 @@ QString OMacAddress::toString() const
+QString OMacAddress::manufacturer() const
+{
+ return OManufacturerDB::instance()->lookup( toString() );
+}
+
bool operator==( const OMacAddress &m1, const OMacAddress &m2 )
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h
index 73d52cc..bedea63 100644
--- a/libopie2/opienet/onetutils.h
+++ b/libopie2/opienet/onetutils.h
@@ -57,3 +57,4 @@ class OMacAddress
- QString toString() const;
+ QString manufacturer() const;
+ QString toString( bool substitute = false ) const;
const unsigned char* native() const;
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 6ddd457..40aac2c 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -641,7 +641,7 @@ OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct i
{
- //qDebug( "size of header = %d", sizeof( struct ieee_802_11_data_header ) );
- //qDebug( "header: %0x", data );
+ qDebug( "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." );
+
const unsigned char* payload = (const unsigned char*) data + sizeof( struct ieee_802_11_data_header );
- //qDebug( "payload: %0x", payload );
+ #warning The next line works for most cases, but can not be correct generally!
if (!( ( (OWaveLanPacket*) this->parent())->duration() )) payload -= 6; // compensation for missing last address
@@ -662,3 +662,3 @@ OWaveLanDataPacket::~OWaveLanDataPacket()
OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2_header* data, QObject* parent )
- :QObject( parent, "802.11 802_2" ), _header( data )
+ :QObject( parent, "802.11 LLC" ), _header( data )
{
diff --git a/libopie2/opienet/opienet.pro b/libopie2/opienet/opienet.pro
index e73afbf..3f9166a 100644
--- a/libopie2/opienet/opienet.pro
+++ b/libopie2/opienet/opienet.pro
@@ -3,5 +3,10 @@ CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/lib
-HEADERS = onetutils.cpp onetwork.h opcap.h
-
-SOURCES = onetutils.cpp onetwork.cpp opcap.cpp
+HEADERS = omanufacturerdb.cpp \
+ onetutils.cpp \
+ onetwork.h \
+ opcap.h
+SOURCES = omanufacturerdb.cpp \
+ onetutils.cpp \
+ onetwork.cpp \
+ opcap.cpp
INTERFACES =
@@ -12,3 +17,2 @@ DEPENDPATH += $(OPIEDIR)/include
LIBS += -lpcap
-
MOC_DIR = moc