author | mickeyl <mickeyl> | 2003-05-03 21:33:49 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-03 21:33:49 (UTC) |
commit | 031031a22a8482c674b250c9f32a758f11139aeb (patch) (unidiff) | |
tree | 79126fc719c74361eb1966d774cdf75c04c82a7c /noncore/net/wellenreiter/gui/wellenreiter.cpp | |
parent | cbaa70d78b1dccce4dc54baba5fc35431467972f (diff) | |
download | opie-031031a22a8482c674b250c9f32a758f11139aeb.zip opie-031031a22a8482c674b250c9f32a758f11139aeb.tar.gz opie-031031a22a8482c674b250c9f32a758f11139aeb.tar.bz2 |
prepare for i18n
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index c061319..62bda91 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -159,29 +159,33 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
159 | qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); | 159 | qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); |
160 | return; | 160 | return; |
161 | } | 161 | } |
162 | 162 | ||
163 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 163 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
164 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 164 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
165 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 165 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
166 | int channel = ds ? ds->channel() : -1; | 166 | int channel = ds ? ds->channel() : -1; |
167 | 167 | ||
168 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 168 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
169 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); | 169 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); |
170 | 170 | ||
171 | // do we have a prism header? | 171 | // update graph window |
172 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 172 | if ( ds ) |
173 | if ( ds && prism ) | 173 | { |
174 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 174 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
175 | 175 | if ( prism ) | |
176 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | ||
177 | else | ||
178 | graphwindow->traffic( ds->channel(), 95 ); | ||
179 | } | ||
176 | return; | 180 | return; |
177 | } | 181 | } |
178 | 182 | ||
179 | // check for a data frame | 183 | // check for a data frame |
180 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); | 184 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); |
181 | if ( data ) | 185 | if ( data ) |
182 | { | 186 | { |
183 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 187 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
184 | if ( wlan->fromDS() && !wlan->toDS() ) | 188 | if ( wlan->fromDS() && !wlan->toDS() ) |
185 | { | 189 | { |
186 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | 190 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", |
187 | (const char*) wlan->macAddress3().toString(true), | 191 | (const char*) wlan->macAddress3().toString(true), |
@@ -250,103 +254,107 @@ void Wellenreiter::stopClicked() | |||
250 | iface->setMonitorMode( false ); | 254 | iface->setMonitorMode( false ); |
251 | // switch off promisc flag | 255 | // switch off promisc flag |
252 | iface->setPromiscuousMode( false ); | 256 | iface->setPromiscuousMode( false ); |
253 | 257 | ||
254 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 258 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
255 | } | 259 | } |
256 | 260 | ||
257 | logwindow->log( "(i) Stopped Scanning." ); | 261 | logwindow->log( "(i) Stopped Scanning." ); |
258 | assert( parent() ); | 262 | assert( parent() ); |
259 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 263 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
260 | 264 | ||
261 | // message the user | 265 | // message the user |
262 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | 266 | QMessageBox::information( this, "Wellenreiter II", |
267 | tr( "Your wireless card\nshould now be usable again." ) ); | ||
263 | 268 | ||
264 | sniffing = false; | 269 | sniffing = false; |
265 | emit( stoppedSniffing() ); | 270 | emit( stoppedSniffing() ); |
266 | 271 | ||
267 | // print out statistics | 272 | // print out statistics |
268 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 273 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
269 | statwindow->updateCounter( it.key(), it.data() ); | 274 | statwindow->updateCounter( it.key(), it.data() ); |
270 | } | 275 | } |
271 | 276 | ||
272 | 277 | ||
273 | void Wellenreiter::startClicked() | 278 | void Wellenreiter::startClicked() |
274 | { | 279 | { |
275 | // get configuration from config window | 280 | // get configuration from config window |
276 | 281 | ||
277 | const QString& interface = configwindow->interfaceName->currentText(); | 282 | const QString& interface = configwindow->interfaceName->currentText(); |
278 | const int cardtype = configwindow->daemonDeviceType(); | 283 | const int cardtype = configwindow->daemonDeviceType(); |
279 | const int interval = configwindow->daemonHopInterval(); | 284 | const int interval = configwindow->daemonHopInterval(); |
280 | 285 | ||
281 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 286 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
282 | { | 287 | { |
283 | QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); | 288 | QMessageBox::information( this, "Wellenreiter II", |
289 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | ||
284 | return; | 290 | return; |
285 | } | 291 | } |
286 | 292 | ||
287 | // configure device | 293 | // configure device |
288 | 294 | ||
289 | ONetwork* net = ONetwork::instance(); | 295 | ONetwork* net = ONetwork::instance(); |
290 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 296 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
291 | 297 | ||
292 | // set monitor mode | 298 | // set monitor mode |
293 | 299 | ||
294 | switch ( cardtype ) | 300 | switch ( cardtype ) |
295 | { | 301 | { |
296 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; | 302 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; |
297 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | 303 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
298 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | 304 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
299 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | 305 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; |
300 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); break; | 306 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
301 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 307 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
302 | default: assert( 0 ); // shouldn't reach this | 308 | default: assert( 0 ); // shouldn't reach this |
303 | } | 309 | } |
304 | 310 | ||
305 | // switch device into monitor mode | 311 | // switch device into monitor mode |
306 | if ( cardtype < DEVTYPE_FILE ) | 312 | if ( cardtype < DEVTYPE_FILE ) |
307 | { | 313 | { |
308 | if ( cardtype != DEVTYPE_MANUAL ) | 314 | if ( cardtype != DEVTYPE_MANUAL ) |
309 | iface->setMonitorMode( true ); | 315 | iface->setMonitorMode( true ); |
310 | if ( !iface->monitorMode() ) | 316 | if ( !iface->monitorMode() ) |
311 | { | 317 | { |
312 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); | 318 | QMessageBox::warning( this, "Wellenreiter II", |
319 | tr( "Can't set device into monitor mode." ) ); | ||
313 | return; | 320 | return; |
314 | } | 321 | } |
315 | } | 322 | } |
316 | 323 | ||
317 | // open pcap and start sniffing | 324 | // open pcap and start sniffing |
318 | if ( cardtype != DEVTYPE_FILE ) | 325 | if ( cardtype != DEVTYPE_FILE ) |
319 | { | 326 | { |
320 | if ( configwindow->writeCaptureFile->isEnabled() ) | 327 | if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? |
321 | { | 328 | { |
322 | QString dumpname( configwindow->captureFileName->text() ); | 329 | QString dumpname( configwindow->captureFileName->text() ); |
323 | dumpname.append( '-' ); | 330 | dumpname.append( '-' ); |
324 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 331 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
325 | dumpname.append( ".wellenreiter" ); | 332 | dumpname.append( ".wellenreiter" ); |
326 | pcap->open( interface, dumpname ); | 333 | pcap->open( interface, dumpname ); |
327 | } | 334 | } |
328 | else | 335 | else |
329 | { | 336 | { |
330 | pcap->open( interface ); | 337 | pcap->open( interface ); |
331 | } | 338 | } |
332 | } | 339 | } |
333 | else | 340 | else |
334 | { | 341 | { |
335 | pcap->open( QFile( interface ) ); | 342 | pcap->open( QFile( interface ) ); |
336 | } | 343 | } |
337 | 344 | ||
338 | if ( !pcap->isOpen() ) | 345 | if ( !pcap->isOpen() ) |
339 | { | 346 | { |
340 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | 347 | QMessageBox::warning( this, "Wellenreiter II", |
348 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); | ||
341 | return; | 349 | return; |
342 | } | 350 | } |
343 | 351 | ||
344 | // set capturer to non-blocking mode | 352 | // set capturer to non-blocking mode |
345 | pcap->setBlocking( false ); | 353 | pcap->setBlocking( false ); |
346 | 354 | ||
347 | // start channel hopper | 355 | // start channel hopper |
348 | if ( cardtype != DEVTYPE_FILE ) | 356 | if ( cardtype != DEVTYPE_FILE ) |
349 | iface->setChannelHopping( 1000 ); //use interval from config window | 357 | iface->setChannelHopping( 1000 ); //use interval from config window |
350 | 358 | ||
351 | if ( cardtype != DEVTYPE_FILE ) | 359 | if ( cardtype != DEVTYPE_FILE ) |
352 | { | 360 | { |
@@ -358,25 +366,25 @@ void Wellenreiter::startClicked() | |||
358 | { | 366 | { |
359 | // start timer for reading packets | 367 | // start timer for reading packets |
360 | startTimer( 100 ); | 368 | startTimer( 100 ); |
361 | } | 369 | } |
362 | 370 | ||
363 | logwindow->log( "(i) Started Scanning." ); | 371 | logwindow->log( "(i) Started Scanning." ); |
364 | sniffing = true; | 372 | sniffing = true; |
365 | emit( startedSniffing() ); | 373 | emit( startedSniffing() ); |
366 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 374 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
367 | else | 375 | else |
368 | { | 376 | { |
369 | assert( parent() ); | 377 | assert( parent() ); |
370 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." ); | 378 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
371 | } | 379 | } |
372 | } | 380 | } |
373 | 381 | ||
374 | 382 | ||
375 | void Wellenreiter::timerEvent( QTimerEvent* ) | 383 | void Wellenreiter::timerEvent( QTimerEvent* ) |
376 | { | 384 | { |
377 | qDebug( "Wellenreiter::timerEvent()" ); | 385 | qDebug( "Wellenreiter::timerEvent()" ); |
378 | OPacket* p = pcap->next(); | 386 | OPacket* p = pcap->next(); |
379 | if ( !p ) // no more packets available | 387 | if ( !p ) // no more packets available |
380 | { | 388 | { |
381 | stopClicked(); | 389 | stopClicked(); |
382 | } | 390 | } |