-rw-r--r-- | libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | 63 | ||||
-rw-r--r-- | libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | 1 | ||||
-rw-r--r-- | libopie2/libopie2.control | 6 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 96 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 37 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 21 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 3 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/opienet.pro | 12 |
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 @@ -38,165 +38,180 @@ public: if ( argc < 3 ) { printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] ); printf( "\n" ); printf( "Valid wireless interfaces (detected) are:\n" ); ONetwork::InterfaceIterator it = net->iterator(); while ( it.current() ) { if ( it.current()->isWireless() ) { printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), (const char*) it.current()->macAddress().toString(), (const char*) it.current()->ipV4Address() ); } ++it; } exit( -1 ); } printf( "****************************************************\n" ); printf( "* Wellenreiter mini edition 1.0 (C) 2003 M-M-M *\n" ); printf( "****************************************************\n" ); printf( "\n\n" ); QString interface( argv[1] ); QString driver( argv[2] ); printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); // sanity checks before downcasting ONetworkInterface* iface = net->interface( interface ); if ( !iface ) { printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); exit( -1 ); } if ( !iface->isWireless() ) { printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); exit( -1 ); } // downcast should be safe now wiface = (OWirelessNetworkInterface*) iface; printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); - /* - - // 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 if ( !wiface->promiscuousMode() ) { printf( "Interface status is not promisc... switching to promisc... " ); wiface->setPromiscuousMode( true ); if ( !wiface->promiscuousMode() ) { printf( "failed (%s). Exiting.\n", strerror( errno ) ); exit( -1 ); } else { printf( "ok.\n" ); } } else printf( "Interface status is already promisc - good.\n" ); // connect a monitoring strategy to the interface if ( driver == "orinoco" ) new OOrinocoMonitoringInterface( wiface ); else { printf( "Unknown driver. Exiting\n" ); exit( -1 ); } // enable monitoring mode printf( "Enabling monitor mode...\n" ); wiface->setMonitorMode( true ); // open a packet capturer cap = new OPacketCapturer(); cap->open( interface ); if ( !cap->isOpen() ) { printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); exit( -1 ); } // set capturer to non-blocking mode cap->setBlocking( false ); // start channel hopper wiface->setChannelHopping( 1000 ); // connect connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); } ~Wellenreiter() {}; public slots: void receivePacket(OPacket* p) { if (!p) { printf( "(empty packet received)\n" ); return; } OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); - if ( beacon ) { OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID() : "<unknown>"; if ( stations.find( essid ) ) stations[essid]->beacons++; else { printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); stations.insert( essid, new Station( "unknown", wiface->channel(), ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); } + 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; } } private: OPacketCapturer* cap; OWirelessNetworkInterface* wiface; }; int main( int argc, char** argv ) { Wellenreiter w( argc, argv ); w.exec(); return 0; } #include "miniwellenreiter.moc" 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 @@ -1,61 +1,62 @@ #include <opie2/onetwork.h> int main( int argc, char** argv ) { qDebug( "OPIE Network Demo" ); ONetwork* net = ONetwork::instance(); ONetwork::InterfaceIterator it = net->iterator(); while ( it.current() ) { qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); 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() ); if ( it.current()->isWireless() ) { OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) //{ qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP() ); //} // try to set monitor mode /* // first some wrong calls to check if this is working iface->setPrivate( "seppel", 10 ); iface->setPrivate( "monitor", 0 ); // now the real deal iface->setPrivate( "monitor", 2, 2, 3 ); */ // trying to set hw address to 12:34:56:AB:CD:EF /* OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); iface->setUp( false ); iface->setMacAddress( addr ); iface->setUp( true ); qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); */ } ++it; } return 0; } diff --git a/libopie2/libopie2.control b/libopie2/libopie2.control index 24a7c37..866d106 100644 --- a/libopie2/libopie2.control +++ b/libopie2/libopie2.control @@ -1,10 +1,10 @@ -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 Section: opie/system 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 @@ -1,169 +1,178 @@ /* This file is part of the Opie Project (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> =. .=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_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: 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 <opie2/onetutils.h> #include <opie2/onetwork.h> +#include <opie2/omanufacturerdb.h> #include <net/if.h> #include <cstdio> using namespace std; #define IW_PRIV_TYPE_MASK 0x7000 #define IW_PRIV_TYPE_NONE 0x0000 #define IW_PRIV_TYPE_BYTE 0x1000 #define IW_PRIV_TYPE_CHAR 0x2000 #define IW_PRIV_TYPE_INT 0x4000 #define IW_PRIV_TYPE_FLOAT 0x5000 #define IW_PRIV_TYPE_ADDR 0x6000 #define IW_PRIV_SIZE_FIXED 0x0800 #define IW_PRIV_SIZE_MASK 0x07FF /*====================================================================================== * OMacAddress *======================================================================================*/ // static initializer for broadcast and unknown MAC Adresses const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); //TODO: Incorporate Ethernet Manufacturer database here! OMacAddress::OMacAddress( unsigned char* p ) { memcpy( _bytes, p, 6 ); } OMacAddress::OMacAddress( const unsigned char* p ) { memcpy( _bytes, p, 6 ); } OMacAddress::OMacAddress( struct ifreq& ifr ) { memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); } OMacAddress::~OMacAddress() { } //#ifdef QT_NO_DEBUG //inline //#endif const unsigned char* OMacAddress::native() const { return (const unsigned char*) &_bytes; } OMacAddress OMacAddress::fromString( const QString& str ) { QString addr( str ); unsigned char buf[6]; bool ok = true; int index = 14; for ( int i = 5; i >= 0; --i ) { buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); if ( !ok ) return OMacAddress::unknown; addr.truncate( index ); index -= 3; } return (const unsigned char*) &buf; } -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; } +QString OMacAddress::manufacturer() const +{ + return OManufacturerDB::instance()->lookup( toString() ); +} + bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) { return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; } /*====================================================================================== * OHostAddress *======================================================================================*/ /*====================================================================================== * OPrivateIOCTL *======================================================================================*/ OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) { } OPrivateIOCTL::~OPrivateIOCTL() { } #ifdef QT_NO_DEBUG inline #endif int OPrivateIOCTL::numberGetArgs() const { return _getargs & IW_PRIV_SIZE_MASK; } #ifdef QT_NO_DEBUG inline #endif int OPrivateIOCTL::typeGetArgs() const { return _getargs & IW_PRIV_TYPE_MASK >> 12; } #ifdef QT_NO_DEBUG inline #endif int OPrivateIOCTL::numberSetArgs() const 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 @@ -10,97 +10,98 @@ :`=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_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: 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 ONETUTILS_H #define ONETUTILS_H #include <qdict.h> #include <qmap.h> #include <qstring.h> #include <qhostaddress.h> #include <qobject.h> #include <sys/types.h> struct ifreq; class OWirelessNetworkInterface; /*====================================================================================== * OMacAddress *======================================================================================*/ class OMacAddress { public: OMacAddress( unsigned char* ); OMacAddress( const unsigned char* ); OMacAddress( struct ifreq& ); ~OMacAddress(); - QString toString() const; + QString manufacturer() const; + QString toString( bool substitute = false ) const; const unsigned char* native() const; static OMacAddress fromString( const QString& ); public: static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff static const OMacAddress& unknown; // 44:44:44:44:44:44 private: unsigned char _bytes[6]; friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); }; bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); /*====================================================================================== * OHostAddress *======================================================================================*/ class OHostAddress : public QHostAddress { public: OHostAddress(); ~OHostAddress(); }; /*====================================================================================== * OPrivateIOCTL *======================================================================================*/ class OPrivateIOCTL : public QObject { public: OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); ~OPrivateIOCTL(); int numberGetArgs() const; int typeGetArgs() const; int numberSetArgs() const; int typeSetArgs() const; void invoke() const; void setParameter( int, u_int32_t ); 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 @@ -594,118 +594,118 @@ int OWaveLanManagementDS::channel() const OWaveLanManagementTim::OWaveLanManagementTim( const unsigned char* end, const struct tim_t* data, QObject* parent ) :QObject( parent, "802.11 Tim" ), _data( data ) { qDebug( "OWaveLanManagementTim()" ); } OWaveLanManagementTim::~OWaveLanManagementTim() { } /*====================================================================================== * OWaveLanManagementIBSS *======================================================================================*/ OWaveLanManagementIBSS::OWaveLanManagementIBSS( const unsigned char* end, const struct ibss_t* data, QObject* parent ) :QObject( parent, "802.11 IBSS" ), _data( data ) { qDebug( "OWaveLanManagementIBSS()" ); } OWaveLanManagementIBSS::~OWaveLanManagementIBSS() { } /*====================================================================================== * OWaveLanManagementChallenge *======================================================================================*/ OWaveLanManagementChallenge::OWaveLanManagementChallenge( const unsigned char* end, const struct challenge_t* data, QObject* parent ) :QObject( parent, "802.11 Challenge" ), _data( data ) { qDebug( "OWaveLanManagementChallenge()" ); } OWaveLanManagementChallenge::~OWaveLanManagementChallenge() { } /*====================================================================================== * OWaveLanDataPacket *======================================================================================*/ OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct ieee_802_11_data_header* data, OWaveLanPacket* parent ) :QObject( parent, "802.11 Data" ), _header( data ) { - //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 new OLLCPacket( end, (const struct ieee_802_11_802_2_header*) payload, this ); } OWaveLanDataPacket::~OWaveLanDataPacket() { } /*====================================================================================== * OLLCPacket *======================================================================================*/ 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 ) { qDebug( "OLLCPacket::OLLCPacket(): decoding frame..." ); if ( !(_header->oui[0] || _header->oui[1] || _header->oui[2]) ) { qDebug( "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type=%04X)", EXTRACT_16BITS( &_header->type ) ); switch ( EXTRACT_16BITS( &_header->type ) ) // defined in linux/if_ether.h { case ETH_P_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break; default: qDebug( "OLLCPacket::OLLCPacket(): Unknown Encapsulation Type" ); } } } OLLCPacket::~OLLCPacket() { } /*====================================================================================== * OPacketCapturer *======================================================================================*/ OPacketCapturer::OPacketCapturer( QObject* parent, const char* name ) :QObject( parent, name ), _name( QString::null ), _open( false ), _pch( 0 ), _sn( 0 ) { } OPacketCapturer::~OPacketCapturer() { if ( _open ) { qDebug( "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." ); close(); } } void OPacketCapturer::setBlocking( bool b ) { if ( pcap_setnonblock( _pch, 1-b, _errbuf ) != -1 ) { qDebug( "OPacketCapturer::setBlocking(): blocking mode changed successfully." ); } 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 @@ -1,18 +1,22 @@ TEMPLATE = lib 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 = TARGET = opienet2 VERSION = 1.8.1 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lpcap - MOC_DIR = moc OBJECTS_DIR = obj include ( $(OPIEDIR)/include.pro ) |