summaryrefslogtreecommitdiff
path: root/libopie2/examples/opienet/miniwellenreiter
authormickeyl <mickeyl>2003-12-01 22:44:38 (UTC)
committer mickeyl <mickeyl>2003-12-01 22:44:38 (UTC)
commit7a7683d435cfbb4fa2d6ed99fd4a94d388402aec (patch) (side-by-side diff)
tree1a34de131d935f34dd2622e3606ba664a7783e24 /libopie2/examples/opienet/miniwellenreiter
parenta4a47fca8badeca2b1aae51b39295ccdc8782c4f (diff)
downloadopie-7a7683d435cfbb4fa2d6ed99fd4a94d388402aec.zip
opie-7a7683d435cfbb4fa2d6ed99fd4a94d388402aec.tar.gz
opie-7a7683d435cfbb4fa2d6ed99fd4a94d388402aec.tar.bz2
slowly start to refactor & cleanup libopie2 before merging it with libopie1
Diffstat (limited to 'libopie2/examples/opienet/miniwellenreiter') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp25
-rw-r--r--libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro4
2 files changed, 22 insertions, 7 deletions
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
index c49daa0..eb2e8e8 100644
--- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
+++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
@@ -28,13 +28,13 @@ QDict<Station> stations;
//======================== Application class ===============================
class Wellenreiter : public QApplication
{
Q_OBJECT
public:
- Wellenreiter( int argc, char** argv ) : QApplication( argc, argv )
+ Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ), channel( 1 )
{
ONetwork* net = ONetwork::instance();
if ( argc < 3 )
{
@@ -53,15 +53,15 @@ public:
}
++it;
}
exit( -1 );
}
- printf( "****************************************************\n" );
- printf( "* Wellenreiter mini edition 1.0 (C) 2003 M-M-M *\n" );
- printf( "****************************************************\n" );
+ printf( "*******************************************************************\n" );
+ printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\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 );
@@ -102,20 +102,26 @@ public:
printf( "Interface status is already promisc - good.\n" );
// connect a monitoring strategy to the interface
if ( driver == "orinoco" )
new OOrinocoMonitoringInterface( wiface, false );
else
+ if ( driver == "hostap" )
+ new OHostAPMonitoringInterface( wiface, false );
+ else
+ if ( driver == "wlan-ng" )
+ new OWlanNGMonitoringInterface( wiface, false );
+ else
{
printf( "Unknown driver. Exiting\n" );
exit( -1 );
}
// enable monitoring mode
printf( "Enabling monitor mode...\n" );
- //wiface->setMonitorMode( true );
+ wiface->setMode( "monitor" );
// open a packet capturer
cap = new OPacketCapturer();
cap->open( interface );
if ( !cap->isOpen() )
{
@@ -128,18 +134,26 @@ public:
// start channel hopper
//wiface->setChannelHopping( 1000 );
// connect
connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
+ // timer
+ startTimer( 1000 );
}
~Wellenreiter() {};
public slots:
+ virtual void timerEvent(QTimerEvent* e)
+ {
+ wiface->setChannel( channel++ );
+ if ( channel == 14 ) channel = 1;
+ }
+
void receivePacket(OPacket* p)
{
if (!p)
{
printf( "(empty packet received)\n" );
return;
@@ -200,12 +214,13 @@ public slots:
return;
}
}
private:
OPacketCapturer* cap;
OWirelessNetworkInterface* wiface;
+ int channel;
};
int main( int argc, char** argv )
{
Wellenreiter w( argc, argv );
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro
index 7ce535c..b2c5c14 100644
--- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro
+++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro
@@ -3,11 +3,11 @@ CONFIG = qt warn_on debug
HEADERS =
SOURCES = miniwellenreiter.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lopiecore2 -lopienet2
TARGET = miniwellenreiter
-MOC_DIR = moc
-OBJECTS_DIR = obj
+MOC_DIR = moc
+OBJECTS_DIR = obj
include ( $(OPIEDIR)/include.pro )