summaryrefslogtreecommitdiff
path: root/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
Unidiff
Diffstat (limited to 'libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp25
1 files changed, 20 insertions, 5 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;
28//======================== Application class =============================== 28//======================== Application class ===============================
29 29
30class Wellenreiter : public QApplication 30class Wellenreiter : public QApplication
31{ 31{
32Q_OBJECT 32Q_OBJECT
33public: 33public:
34 Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ) 34 Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ), channel( 1 )
35 { 35 {
36 36
37 ONetwork* net = ONetwork::instance(); 37 ONetwork* net = ONetwork::instance();
38 38
39 if ( argc < 3 ) 39 if ( argc < 3 )
40 { 40 {
@@ -53,15 +53,15 @@ public:
53 } 53 }
54 ++it; 54 ++it;
55 } 55 }
56 exit( -1 ); 56 exit( -1 );
57 } 57 }
58 58
59 printf( "****************************************************\n" ); 59 printf( "*******************************************************************\n" );
60 printf( "* Wellenreiter mini edition 1.0 (C) 2003 M-M-M *\n" ); 60 printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\n" );
61 printf( "****************************************************\n" ); 61 printf( "*******************************************************************\n" );
62 printf( "\n\n" ); 62 printf( "\n\n" );
63 63
64 QString interface( argv[1] ); 64 QString interface( argv[1] );
65 QString driver( argv[2] ); 65 QString driver( argv[2] );
66 66
67 printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); 67 printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver );
@@ -102,20 +102,26 @@ public:
102 printf( "Interface status is already promisc - good.\n" ); 102 printf( "Interface status is already promisc - good.\n" );
103 103
104 // connect a monitoring strategy to the interface 104 // connect a monitoring strategy to the interface
105 if ( driver == "orinoco" ) 105 if ( driver == "orinoco" )
106 new OOrinocoMonitoringInterface( wiface, false ); 106 new OOrinocoMonitoringInterface( wiface, false );
107 else 107 else
108 if ( driver == "hostap" )
109 new OHostAPMonitoringInterface( wiface, false );
110 else
111 if ( driver == "wlan-ng" )
112 new OWlanNGMonitoringInterface( wiface, false );
113 else
108 { 114 {
109 printf( "Unknown driver. Exiting\n" ); 115 printf( "Unknown driver. Exiting\n" );
110 exit( -1 ); 116 exit( -1 );
111 } 117 }
112 118
113 // enable monitoring mode 119 // enable monitoring mode
114 printf( "Enabling monitor mode...\n" ); 120 printf( "Enabling monitor mode...\n" );
115 //wiface->setMonitorMode( true ); 121 wiface->setMode( "monitor" );
116 122
117 // open a packet capturer 123 // open a packet capturer
118 cap = new OPacketCapturer(); 124 cap = new OPacketCapturer();
119 cap->open( interface ); 125 cap->open( interface );
120 if ( !cap->isOpen() ) 126 if ( !cap->isOpen() )
121 { 127 {
@@ -128,18 +134,26 @@ public:
128 134
129 // start channel hopper 135 // start channel hopper
130 //wiface->setChannelHopping( 1000 ); 136 //wiface->setChannelHopping( 1000 );
131 137
132 // connect 138 // connect
133 connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 139 connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
140 // timer
141 startTimer( 1000 );
134 142
135 } 143 }
136 144
137 ~Wellenreiter() {}; 145 ~Wellenreiter() {};
138 146
139public slots: 147public slots:
148 virtual void timerEvent(QTimerEvent* e)
149 {
150 wiface->setChannel( channel++ );
151 if ( channel == 14 ) channel = 1;
152 }
153
140 void receivePacket(OPacket* p) 154 void receivePacket(OPacket* p)
141 { 155 {
142 if (!p) 156 if (!p)
143 { 157 {
144 printf( "(empty packet received)\n" ); 158 printf( "(empty packet received)\n" );
145 return; 159 return;
@@ -200,12 +214,13 @@ public slots:
200 return; 214 return;
201 } 215 }
202 } 216 }
203private: 217private:
204 OPacketCapturer* cap; 218 OPacketCapturer* cap;
205 OWirelessNetworkInterface* wiface; 219 OWirelessNetworkInterface* wiface;
220 int channel;
206}; 221};
207 222
208 223
209int main( int argc, char** argv ) 224int main( int argc, char** argv )
210{ 225{
211 Wellenreiter w( argc, argv ); 226 Wellenreiter w( argc, argv );