4 files changed, 28 insertions, 10 deletions
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp index 74886fa..e8bf04f 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp | |||
@@ -47,92 +47,94 @@ public: | |||
47 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); | 47 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); |
48 | 48 | ||
49 | if ( mode != -1 ) g->setButton( mode ); | 49 | if ( mode != -1 ) g->setButton( mode ); |
50 | 50 | ||
51 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); | 51 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); |
52 | e = new QLineEdit( hbox ); | 52 | e = new QLineEdit( hbox ); |
53 | QPushButton* pb = new QPushButton( hbox ); | 53 | QPushButton* pb = new QPushButton( hbox ); |
54 | 54 | ||
55 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); | 55 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); |
56 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); | 56 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); |
57 | 57 | ||
58 | // show the additional debug mode dependent output information | 58 | // show the additional debug mode dependent output information |
59 | e->setText( OGlobalSettings::debugOutput() ); | 59 | e->setText( OGlobalSettings::debugOutput() ); |
60 | 60 | ||
61 | // buttos | 61 | // buttos |
62 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); | 62 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); |
63 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); | 63 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); |
64 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); | 64 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); |
65 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); | 65 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); |
66 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); | 66 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); |
67 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); | 67 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); |
68 | QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox ); | 68 | QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox ); |
69 | connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) ); | 69 | connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) ); |
70 | 70 | ||
71 | QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox ); | 71 | QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox ); |
72 | connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) ); | 72 | connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) ); |
73 | 73 | ||
74 | info->show(); | 74 | info->show(); |
75 | warn->show(); | 75 | warn->show(); |
76 | error->show(); | 76 | error->show(); |
77 | fatal->show(); | 77 | fatal->show(); |
78 | tb->show(); | 78 | tb->show(); |
79 | g->show(); | 79 | g->show(); |
80 | hbox->show(); | 80 | hbox->show(); |
81 | e->show(); | 81 | e->show(); |
82 | vbox->show(); | 82 | vbox->show(); |
83 | showMainWidget( vbox ); | 83 | showMainWidget( vbox ); |
84 | } | 84 | } |
85 | 85 | ||
86 | public slots: | 86 | public slots: |
87 | void chooseMethod(int method) | 87 | void chooseMethod(int method) |
88 | { | 88 | { |
89 | m = method; | 89 | m = method; |
90 | qDebug( "choosing method: %d", method ); | 90 | qDebug( "choosing method: %d", method ); |
91 | OConfig* g = OGlobal::config(); | 91 | OConfig* g = OGlobal::config(); |
92 | g->setGroup( "General" ); | 92 | g->setGroup( "General" ); |
93 | g->writeEntry( "debugMode", m ); | 93 | g->writeEntry( "debugMode", m ); |
94 | e->setText( OGlobalSettings::debugOutput() ); | 94 | e->setText( OGlobalSettings::debugOutput() ); |
95 | g->write(); | ||
95 | } | 96 | } |
96 | void updateDebugOutput() | 97 | void updateDebugOutput() |
97 | { | 98 | { |
98 | OConfig* g = OGlobal::config(); | 99 | OConfig* g = OGlobal::config(); |
99 | g->setGroup( "General" ); | 100 | g->setGroup( "General" ); |
100 | g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); | 101 | g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); |
102 | g->write(); | ||
101 | } | 103 | } |
102 | void emitInfoOutput() | 104 | void emitInfoOutput() |
103 | { | 105 | { |
104 | odebug << "This is a debug message" << oendl; | 106 | odebug << "This is a debug message" << oendl; |
105 | } | 107 | } |
106 | void emitWarningOutput() | 108 | void emitWarningOutput() |
107 | { | 109 | { |
108 | owarn << "This is a warning message" << oendl; | 110 | owarn << "This is a warning message" << oendl; |
109 | } | 111 | } |
110 | void emitErrorOutput() | 112 | void emitErrorOutput() |
111 | { | 113 | { |
112 | oerr << "This is an errror message" << oendl; | 114 | oerr << "This is an errror message" << oendl; |
113 | } | 115 | } |
114 | void emitFatalOutput() | 116 | void emitFatalOutput() |
115 | { | 117 | { |
116 | ofatal << "This is a fatal message" << oendl; | 118 | ofatal << "This is a fatal message" << oendl; |
117 | } | 119 | } |
118 | void emitTBOutput() | 120 | void emitTBOutput() |
119 | { | 121 | { |
120 | ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n | 122 | ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n |
121 | } | 123 | } |
122 | 124 | ||
123 | private: | 125 | private: |
124 | QButtonGroup* g; | 126 | QButtonGroup* g; |
125 | int m; | 127 | int m; |
126 | QLineEdit* e; | 128 | QLineEdit* e; |
127 | }; | 129 | }; |
128 | 130 | ||
129 | int main( int argc, char** argv ) | 131 | int main( int argc, char** argv ) |
130 | { | 132 | { |
131 | DemoApp* app = new DemoApp( argc, argv ); | 133 | DemoApp* app = new DemoApp( argc, argv ); |
132 | app->exec(); | 134 | app->exec(); |
133 | 135 | ||
134 | return 0; | 136 | return 0; |
135 | 137 | ||
136 | } | 138 | } |
137 | 139 | ||
138 | #include "moc/odebugdemo.moc" | 140 | #include "moc/odebugdemo.moc" |
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 | |||
@@ -1,217 +1,232 @@ | |||
1 | #include <qdict.h> | 1 | #include <qdict.h> |
2 | #include <qsocketnotifier.h> | 2 | #include <qsocketnotifier.h> |
3 | #include <qstring.h> | 3 | #include <qstring.h> |
4 | #include <opie2/onetwork.h> | 4 | #include <opie2/onetwork.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <opie2/opcap.h> | 6 | #include <opie2/opcap.h> |
7 | #include <cerrno> | 7 | #include <cerrno> |
8 | #include <cstdio> | 8 | #include <cstdio> |
9 | #include <cstdlib> | 9 | #include <cstdlib> |
10 | #include <cstring> | 10 | #include <cstring> |
11 | 11 | ||
12 | //======================== Station help class =============================== | 12 | //======================== Station help class =============================== |
13 | 13 | ||
14 | class Station | 14 | class Station |
15 | { | 15 | { |
16 | public: | 16 | public: |
17 | Station( QString t, int c, bool w ) : type(t), channel(c), wep(w), beacons(1) {}; | 17 | Station( QString t, int c, bool w ) : type(t), channel(c), wep(w), beacons(1) {}; |
18 | ~Station() {}; | 18 | ~Station() {}; |
19 | 19 | ||
20 | QString type; | 20 | QString type; |
21 | int channel; | 21 | int channel; |
22 | bool wep; | 22 | bool wep; |
23 | int beacons; | 23 | int beacons; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | QDict<Station> stations; | 26 | QDict<Station> stations; |
27 | 27 | ||
28 | //======================== Application class =============================== | 28 | //======================== Application class =============================== |
29 | 29 | ||
30 | class Wellenreiter : public QApplication | 30 | class Wellenreiter : public QApplication |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
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 | { |
41 | printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] ); | 41 | printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] ); |
42 | printf( "\n" ); | 42 | printf( "\n" ); |
43 | printf( "Valid wireless interfaces (detected) are:\n" ); | 43 | printf( "Valid wireless interfaces (detected) are:\n" ); |
44 | 44 | ||
45 | ONetwork::InterfaceIterator it = net->iterator(); | 45 | ONetwork::InterfaceIterator it = net->iterator(); |
46 | while ( it.current() ) | 46 | while ( it.current() ) |
47 | { | 47 | { |
48 | if ( it.current()->isWireless() ) | 48 | if ( it.current()->isWireless() ) |
49 | { | 49 | { |
50 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), | 50 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), |
51 | (const char*) it.current()->macAddress().toString(), | 51 | (const char*) it.current()->macAddress().toString(), |
52 | (const char*) it.current()->ipV4Address() ); | 52 | (const char*) it.current()->ipV4Address() ); |
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 ); |
68 | 68 | ||
69 | // sanity checks before downcasting | 69 | // sanity checks before downcasting |
70 | ONetworkInterface* iface = net->interface( interface ); | 70 | ONetworkInterface* iface = net->interface( interface ); |
71 | if ( !iface ) | 71 | if ( !iface ) |
72 | { | 72 | { |
73 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); | 73 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); |
74 | exit( -1 ); | 74 | exit( -1 ); |
75 | } | 75 | } |
76 | if ( !iface->isWireless() ) | 76 | if ( !iface->isWireless() ) |
77 | { | 77 | { |
78 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); | 78 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); |
79 | exit( -1 ); | 79 | exit( -1 ); |
80 | } | 80 | } |
81 | 81 | ||
82 | // downcast should be safe now | 82 | // downcast should be safe now |
83 | wiface = (OWirelessNetworkInterface*) iface; | 83 | wiface = (OWirelessNetworkInterface*) iface; |
84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); | 84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); |
85 | 85 | ||
86 | // ifconfig +promisc the interface to receive all packets | 86 | // ifconfig +promisc the interface to receive all packets |
87 | if ( !wiface->promiscuousMode() ) | 87 | if ( !wiface->promiscuousMode() ) |
88 | { | 88 | { |
89 | printf( "Interface status is not promisc... switching to promisc... " ); | 89 | printf( "Interface status is not promisc... switching to promisc... " ); |
90 | wiface->setPromiscuousMode( true ); | 90 | wiface->setPromiscuousMode( true ); |
91 | if ( !wiface->promiscuousMode() ) | 91 | if ( !wiface->promiscuousMode() ) |
92 | { | 92 | { |
93 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); | 93 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); |
94 | exit( -1 ); | 94 | exit( -1 ); |
95 | } | 95 | } |
96 | else | 96 | else |
97 | { | 97 | { |
98 | printf( "ok.\n" ); | 98 | printf( "ok.\n" ); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | else | 101 | else |
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 | { |
122 | printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); | 128 | printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); |
123 | exit( -1 ); | 129 | exit( -1 ); |
124 | } | 130 | } |
125 | 131 | ||
126 | // set capturer to non-blocking mode | 132 | // set capturer to non-blocking mode |
127 | cap->setBlocking( false ); | 133 | cap->setBlocking( false ); |
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 | ||
139 | public slots: | 147 | public 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; |
146 | } | 160 | } |
147 | 161 | ||
148 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); | 162 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); |
149 | if ( beacon ) | 163 | if ( beacon ) |
150 | { | 164 | { |
151 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 165 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
152 | QString essid = ssid ? ssid->ID() : "<unknown>"; | 166 | QString essid = ssid ? ssid->ID() : "<unknown>"; |
153 | 167 | ||
154 | if ( stations.find( essid ) ) | 168 | if ( stations.find( essid ) ) |
155 | stations[essid]->beacons++; | 169 | stations[essid]->beacons++; |
156 | else | 170 | else |
157 | { | 171 | { |
158 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); | 172 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); |
159 | stations.insert( essid, new Station( "unknown", wiface->channel(), | 173 | stations.insert( essid, new Station( "unknown", wiface->channel(), |
160 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); | 174 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); |
161 | } | 175 | } |
162 | return; | 176 | return; |
163 | } | 177 | } |
164 | 178 | ||
165 | OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" ); | 179 | OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" ); |
166 | if ( data ) | 180 | if ( data ) |
167 | { | 181 | { |
168 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 182 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
169 | if ( wlan->fromDS() && !wlan->toDS() ) | 183 | if ( wlan->fromDS() && !wlan->toDS() ) |
170 | { | 184 | { |
171 | printf( "FromDS: '%s' -> '%s' via '%s'\n", | 185 | printf( "FromDS: '%s' -> '%s' via '%s'\n", |
172 | (const char*) wlan->macAddress3().toString(true), | 186 | (const char*) wlan->macAddress3().toString(true), |
173 | (const char*) wlan->macAddress1().toString(true), | 187 | (const char*) wlan->macAddress1().toString(true), |
174 | (const char*) wlan->macAddress2().toString(true) ); | 188 | (const char*) wlan->macAddress2().toString(true) ); |
175 | } | 189 | } |
176 | else | 190 | else |
177 | if ( !wlan->fromDS() && wlan->toDS() ) | 191 | if ( !wlan->fromDS() && wlan->toDS() ) |
178 | { | 192 | { |
179 | printf( "ToDS: '%s' -> '%s' via '%s'\n", | 193 | printf( "ToDS: '%s' -> '%s' via '%s'\n", |
180 | (const char*) wlan->macAddress2().toString(true), | 194 | (const char*) wlan->macAddress2().toString(true), |
181 | (const char*) wlan->macAddress3().toString(true), | 195 | (const char*) wlan->macAddress3().toString(true), |
182 | (const char*) wlan->macAddress1().toString(true) ); | 196 | (const char*) wlan->macAddress1().toString(true) ); |
183 | } | 197 | } |
184 | else | 198 | else |
185 | if ( wlan->fromDS() && wlan->toDS() ) | 199 | if ( wlan->fromDS() && wlan->toDS() ) |
186 | { | 200 | { |
187 | printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n", | 201 | printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n", |
188 | (const char*) wlan->macAddress4().toString(true), | 202 | (const char*) wlan->macAddress4().toString(true), |
189 | (const char*) wlan->macAddress3().toString(true), | 203 | (const char*) wlan->macAddress3().toString(true), |
190 | (const char*) wlan->macAddress1().toString(true), | 204 | (const char*) wlan->macAddress1().toString(true), |
191 | (const char*) wlan->macAddress2().toString(true) ); | 205 | (const char*) wlan->macAddress2().toString(true) ); |
192 | } | 206 | } |
193 | else | 207 | else |
194 | { | 208 | { |
195 | printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n", | 209 | printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n", |
196 | (const char*) wlan->macAddress2().toString(true), | 210 | (const char*) wlan->macAddress2().toString(true), |
197 | (const char*) wlan->macAddress1().toString(true), | 211 | (const char*) wlan->macAddress1().toString(true), |
198 | (const char*) wlan->macAddress3().toString(true) ); | 212 | (const char*) wlan->macAddress3().toString(true) ); |
199 | } | 213 | } |
200 | return; | 214 | return; |
201 | } | 215 | } |
202 | } | 216 | } |
203 | private: | 217 | private: |
204 | OPacketCapturer* cap; | 218 | OPacketCapturer* cap; |
205 | OWirelessNetworkInterface* wiface; | 219 | OWirelessNetworkInterface* wiface; |
220 | int channel; | ||
206 | }; | 221 | }; |
207 | 222 | ||
208 | 223 | ||
209 | int main( int argc, char** argv ) | 224 | int main( int argc, char** argv ) |
210 | { | 225 | { |
211 | Wellenreiter w( argc, argv ); | 226 | Wellenreiter w( argc, argv ); |
212 | w.exec(); | 227 | w.exec(); |
213 | return 0; | 228 | return 0; |
214 | } | 229 | } |
215 | 230 | ||
216 | #include "miniwellenreiter.moc" | 231 | #include "miniwellenreiter.moc" |
217 | 232 | ||
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 | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = miniwellenreiter.cpp | 4 | SOURCES = miniwellenreiter.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lopiecore2 -lopienet2 | 7 | LIBS += -lopiecore2 -lopienet2 |
8 | TARGET = miniwellenreiter | 8 | TARGET = miniwellenreiter |
9 | MOC_DIR = moc | 9 | MOC_DIR = moc |
10 | OBJECTS_DIR = obj | 10 | OBJECTS_DIR = obj |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | 13 | ||
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index 06b8b19..4763316 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -65,78 +65,79 @@ int main( int argc, char** argv ) | |||
65 | iface->setMode( "managed" ); | 65 | iface->setMode( "managed" ); |
66 | 66 | ||
67 | */ | 67 | */ |
68 | 68 | ||
69 | /* | 69 | /* |
70 | 70 | ||
71 | // network scan | 71 | // network scan |
72 | 72 | ||
73 | OStationList* stations = iface->scanNetwork(); | 73 | OStationList* stations = iface->scanNetwork(); |
74 | if ( stations ) | 74 | if ( stations ) |
75 | { | 75 | { |
76 | qDebug( "DEMO: # of stations around = %d", stations->count() ); | 76 | qDebug( "DEMO: # of stations around = %d", stations->count() ); |
77 | OStation* station; | 77 | OStation* station; |
78 | for ( station = stations->first(); station != 0; station = stations->next() ) | 78 | for ( station = stations->first(); station != 0; station = stations->next() ) |
79 | { | 79 | { |
80 | qDebug( "DEMO: station dump following..." ); | 80 | qDebug( "DEMO: station dump following..." ); |
81 | station->dump(); | 81 | station->dump(); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | else | 85 | else |
86 | { | 86 | { |
87 | qDebug( "DEMO: Warning! Scan didn't work!" ); | 87 | qDebug( "DEMO: Warning! Scan didn't work!" ); |
88 | } | 88 | } |
89 | 89 | ||
90 | /* | 90 | /* |
91 | 91 | ||
92 | // first some wrong calls to check if this is working | 92 | // first some wrong calls to check if this is working |
93 | iface->setPrivate( "seppel", 10 ); | 93 | iface->setPrivate( "seppel", 10 ); |
94 | iface->setPrivate( "monitor", 0 ); | 94 | iface->setPrivate( "monitor", 0 ); |
95 | 95 | ||
96 | // now the real deal | 96 | // now the real deal |
97 | iface->setPrivate( "monitor", 2, 2, 3 ); | 97 | iface->setPrivate( "monitor", 2, 2, 3 ); |
98 | 98 | ||
99 | // trying to set hw address to 12:34:56:AB:CD:EF | 99 | // trying to set hw address to 12:34:56:AB:CD:EF |
100 | 100 | ||
101 | /* | 101 | /* |
102 | 102 | ||
103 | OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); | 103 | OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); |
104 | iface->setUp( false ); | 104 | iface->setUp( false ); |
105 | iface->setMacAddress( addr ); | 105 | iface->setMacAddress( addr ); |
106 | iface->setUp( true ); | 106 | iface->setUp( true ); |
107 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); | 107 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); |
108 | 108 | ||
109 | */ | 109 | */ |
110 | 110 | ||
111 | // monitor test | 111 | // monitor test |
112 | 112 | ||
113 | /* | 113 | |
114 | 114 | ||
115 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 115 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); |
116 | iface->setMode( "monitor" ); | 116 | iface->setMode( "monitor" ); |
117 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 117 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); |
118 | 118 | ||
119 | sleep( 1 ); */ | 119 | sleep( 1 ); |
120 | 120 | ||
121 | iface->setMode( "master" ); | 121 | iface->setChannel( 1 ); |
122 | iface->setMode( "managed" ); | ||
122 | 123 | ||
123 | //sleep( 1 ); | 124 | //sleep( 1 ); |
124 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 125 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); |
125 | 126 | ||
126 | /*iface->setMode( "adhoc" ); | 127 | /*iface->setMode( "adhoc" ); |
127 | sleep( 1 ); | 128 | sleep( 1 ); |
128 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 129 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); |
129 | iface->setMode( "managed" ); | 130 | iface->setMode( "managed" ); |
130 | sleep( 1 ); | 131 | sleep( 1 ); |
131 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 132 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); |
132 | iface->setMode( "master" ); | 133 | iface->setMode( "master" ); |
133 | sleep( 1 ); | 134 | sleep( 1 ); |
134 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );*/ | 135 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );*/ |
135 | 136 | ||
136 | } | 137 | } |
137 | ++it; | 138 | ++it; |
138 | } | 139 | } |
139 | 140 | ||
140 | return 0; | 141 | return 0; |
141 | 142 | ||
142 | } | 143 | } |