summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp18
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp24
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp26
4 files changed, 38 insertions, 38 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index bfdb20a..279b39c 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -228,25 +228,25 @@ void WellenreiterConfigWindow::changedClientAction(int t)
228} 228}
229 229
230 230
231void WellenreiterConfigWindow::changedStationAction(int t) 231void WellenreiterConfigWindow::changedStationAction(int t)
232{ 232{
233 synchronizeActionsAndScripts(); 233 synchronizeActionsAndScripts();
234} 234}
235 235
236 236
237void WellenreiterConfigWindow::getCaptureFileNameClicked() 237void WellenreiterConfigWindow::getCaptureFileNameClicked()
238{ 238{
239 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 239 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
240 odebug << "name = " << (const char*) name << "" << oendl; 240 odebug << "name = " << name << "" << oendl;
241 if ( !name.isEmpty() ) 241 if ( !name.isEmpty() )
242 { 242 {
243 captureFileName->setText( name ); 243 captureFileName->setText( name );
244 } 244 }
245} 245}
246 246
247 247
248void WellenreiterConfigWindow::channelAllClicked(int state) 248void WellenreiterConfigWindow::channelAllClicked(int state)
249{ 249{
250 bool b = state; 250 bool b = state;
251 channel1->setChecked( b ); 251 channel1->setChecked( b );
252 channel2->setChecked( b ); 252 channel2->setChecked( b );
@@ -303,54 +303,54 @@ void WellenreiterConfigWindow::performAction( const QString& type,
303 else if ( type == "managed" || type == "adhoc" ) 303 else if ( type == "managed" || type == "adhoc" )
304 { 304 {
305 action = newClientAction->currentItem(); 305 action = newClientAction->currentItem();
306 script = newClientScript->text(); 306 script = newClientScript->text();
307 } 307 }
308 else if ( type == "station" ) 308 else if ( type == "station" )
309 { 309 {
310 action = newStationAction->currentItem(); 310 action = newStationAction->currentItem();
311 script = newStationScript->text(); 311 script = newStationScript->text();
312 } 312 }
313 else 313 else
314 { 314 {
315 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl; 315 owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl;
316 return; 316 return;
317 } 317 }
318 318
319 odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl; 319 odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl;
320 320
321 switch( action ) 321 switch( action )
322 { 322 {
323 case 0: /* Ignore */ return; 323 case 0: /* Ignore */ return;
324 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; 324 case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
325 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; 325 case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
326 case 3: /* Blink LED */ break; //FIXME: Implement this 326 case 3: /* Blink LED */ break; //FIXME: Implement this
327 case 4: /* Run Script */ 327 case 4: /* Run Script */
328 { 328 {
329 /** 329 /**
330 * 330 *
331 * Script Substitution Information: 331 * Script Substitution Information:
332 * 332 *
333 * $SSID = SSID 333 * $SSID = SSID
334 * $MAC = MAC 334 * $MAC = MAC
335 * $WEP = Wep 335 * $WEP = Wep
336 * $CHAN = Channel 336 * $CHAN = Channel
337 * 337 *
338 **/ 338 **/
339 script = script.replace( QRegExp( "$SSID" ), essid ); 339 script = script.replace( QRegExp( "$SSID" ), essid );
340 script = script.replace( QRegExp( "$MAC" ), mac ); 340 script = script.replace( QRegExp( "$MAC" ), mac );
341 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); 341 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
342 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); 342 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
343 343
344 odebug << "going to call script '" << (const char*) script << "'" << oendl; 344 odebug << "going to call script '" << script << "'" << oendl;
345 ::system( script ); 345 ::system( script );
346 odebug << "script returned." << oendl; 346 odebug << "script returned." << oendl;
347 return; 347 return;
348 } 348 }
349 default: assert( false ); 349 default: assert( false );
350 } 350 }
351} 351}
352 352
353 353
354void WellenreiterConfigWindow::load() 354void WellenreiterConfigWindow::load()
355{ 355{
356#ifdef Q_WS_X11 356#ifdef Q_WS_X11
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index a4b8839..8525109 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -243,25 +243,25 @@ void WellenreiterMainWindow::demoAddStations()
243 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); 243 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) );
244 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); 244 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
245 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); 245 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
246 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); 246 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
247 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); 247 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
248} 248}
249 249
250 250
251void WellenreiterMainWindow::demoReadFromGps() 251void WellenreiterMainWindow::demoReadFromGps()
252{ 252{
253 WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); 253 WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance();
254 GPS* gps = new GPS( this ); 254 GPS* gps = new GPS( this );
255 odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl; 255 odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl;
256 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 256 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
257 GpsLocation loc = gps->position(); 257 GpsLocation loc = gps->position();
258 QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); 258 QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) );
259 delete gps; 259 delete gps;
260} 260}
261 261
262 262
263QString WellenreiterMainWindow::getFileName( bool save ) 263QString WellenreiterMainWindow::getFileName( bool save )
264{ 264{
265 QMap<QString, QStringList> map; 265 QMap<QString, QStringList> map;
266 map.insert( tr("All"), QStringList() ); 266 map.insert( tr("All"), QStringList() );
267 QStringList text; 267 QStringList text;
@@ -297,93 +297,93 @@ QString WellenreiterMainWindow::getFileName( bool save )
297 297
298void WellenreiterMainWindow::fileSaveLog() 298void WellenreiterMainWindow::fileSaveLog()
299{ 299{
300 QString fname = getFileName( true ); 300 QString fname = getFileName( true );
301 if ( !fname.isEmpty() ) 301 if ( !fname.isEmpty() )
302 { 302 {
303 QFile f( fname ); 303 QFile f( fname );
304 if ( f.open(IO_WriteOnly) ) 304 if ( f.open(IO_WriteOnly) )
305 { 305 {
306 QTextStream t( &f ); 306 QTextStream t( &f );
307 t << mw->logWindow()->getLog(); 307 t << mw->logWindow()->getLog();
308 f.close(); 308 f.close();
309 odebug << "Saved log to file '" << (const char*) fname << "'" << oendl; 309 odebug << "Saved log to file '" << fname << "'" << oendl;
310 } 310 }
311 else 311 else
312 { 312 {
313 odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl; 313 odebug << "Problem saving log to file '" << fname << "'" << oendl;
314 } 314 }
315 } 315 }
316} 316}
317 317
318void WellenreiterMainWindow::fileSaveSession() 318void WellenreiterMainWindow::fileSaveSession()
319{ 319{
320 QString fname = getFileName( true ); 320 QString fname = getFileName( true );
321 if ( !fname.isEmpty() ) 321 if ( !fname.isEmpty() )
322 { 322 {
323 323
324 QFile f( fname ); 324 QFile f( fname );
325 if ( f.open(IO_WriteOnly) ) 325 if ( f.open(IO_WriteOnly) )
326 { 326 {
327 QDataStream t( &f ); 327 QDataStream t( &f );
328 t << *mw->netView(); 328 t << *mw->netView();
329 f.close(); 329 f.close();
330 odebug << "Saved session to file '" << (const char*) fname << "'" << oendl; 330 odebug << "Saved session to file '" << fname << "'" << oendl;
331 } 331 }
332 else 332 else
333 { 333 {
334 odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl; 334 odebug << "Problem saving session to file '" << fname << "'" << oendl;
335 } 335 }
336 } 336 }
337} 337}
338 338
339void WellenreiterMainWindow::fileSaveHex() 339void WellenreiterMainWindow::fileSaveHex()
340{ 340{
341 #warning DOES NOT WORK AT THE MOMENT 341 #warning DOES NOT WORK AT THE MOMENT
342 /* 342 /*
343 QString fname = getFileName( true ); 343 QString fname = getFileName( true );
344 if ( !fname.isEmpty() ) 344 if ( !fname.isEmpty() )
345 { 345 {
346 QFile f( fname ); 346 QFile f( fname );
347 if ( f.open(IO_WriteOnly) ) 347 if ( f.open(IO_WriteOnly) )
348 { 348 {
349 QTextStream t( &f ); 349 QTextStream t( &f );
350 t << mw->hexWindow()->getLog(); 350 t << mw->hexWindow()->getLog();
351 f.close(); 351 f.close();
352 odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl; 352 odebug << "Saved hex log to file '" << fname << "'" << oendl;
353 } 353 }
354 else 354 else
355 { 355 {
356 odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl; 356 odebug << "Problem saving hex log to file '" << fname << "'" << oendl;
357 } 357 }
358 } 358 }
359 */ 359 */
360} 360}
361 361
362void WellenreiterMainWindow::fileLoadSession() 362void WellenreiterMainWindow::fileLoadSession()
363{ 363{
364 QString fname = getFileName( false ); 364 QString fname = getFileName( false );
365 if ( !fname.isEmpty() ) 365 if ( !fname.isEmpty() )
366 { 366 {
367 QFile f( fname ); 367 QFile f( fname );
368 if ( f.open(IO_ReadOnly) ) 368 if ( f.open(IO_ReadOnly) )
369 { 369 {
370 QDataStream t( &f ); 370 QDataStream t( &f );
371 t >> *mw->netView(); 371 t >> *mw->netView();
372 f.close(); 372 f.close();
373 odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl; 373 odebug << "Loaded session from file '" << fname << "'" << oendl;
374 } 374 }
375 else 375 else
376 { 376 {
377 odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl; 377 odebug << "Problem loading session from file '" << fname << "'" << oendl;
378 } 378 }
379 } 379 }
380} 380}
381 381
382 382
383void WellenreiterMainWindow::fileNew() 383void WellenreiterMainWindow::fileNew()
384{ 384{
385 mw->netView()->clear(); 385 mw->netView()->clear();
386 mw->logWindow()->clear(); 386 mw->logWindow()->clear();
387 mw->hexWindow()->clear(); 387 mw->hexWindow()->clear();
388} 388}
389 389
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index a2be782..ed9ec14 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -133,68 +133,68 @@ void MScanListView::addNewItem( const QString& type,
133 (const char*) essid, (const char*) macaddr, channel ); 133 (const char*) essid, (const char*) macaddr, channel );
134 #endif 134 #endif
135 135
136 // search, if we already have seen this net 136 // search, if we already have seen this net
137 137
138 QString s; 138 QString s;
139 MScanListItem* network; 139 MScanListItem* network;
140 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 140 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
141 141
142 while ( item && ( item->text( col_essid ) != essid ) ) 142 while ( item && ( item->text( col_essid ) != essid ) )
143 { 143 {
144 #ifdef DEBUG 144 #ifdef DEBUG
145 odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl; 145 odebug << "itemtext: " << item->text( col_essid ) << "" << oendl;
146 #endif 146 #endif
147 item = static_cast<MScanListItem*> ( item->nextSibling() ); 147 item = static_cast<MScanListItem*> ( item->nextSibling() );
148 } 148 }
149 if ( item ) 149 if ( item )
150 { 150 {
151 // we have already seen this net, check all childs if MAC exists 151 // we have already seen this net, check all childs if MAC exists
152 152
153 network = item; 153 network = item;
154 154
155 item = static_cast<MScanListItem*> ( item->firstChild() ); 155 item = static_cast<MScanListItem*> ( item->firstChild() );
156 assert( item ); // this shouldn't fail 156 assert( item ); // this shouldn't fail
157 157
158 while ( item && ( item->text( col_ap ) != macaddr ) ) 158 while ( item && ( item->text( col_ap ) != macaddr ) )
159 { 159 {
160 #ifdef DEBUG 160 #ifdef DEBUG
161 odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl; 161 odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl;
162 #endif 162 #endif
163 item = static_cast<MScanListItem*> ( item->nextSibling() ); 163 item = static_cast<MScanListItem*> ( item->nextSibling() );
164 } 164 }
165 165
166 if ( item ) 166 if ( item )
167 { 167 {
168 // we have already seen this item, it's a dupe 168 // we have already seen this item, it's a dupe
169 #ifdef DEBUG 169 #ifdef DEBUG
170 odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl; 170 odebug << "" << macaddr << " is a dupe - ignoring..." << oendl;
171 #endif 171 #endif
172 item->receivedBeacon(); 172 item->receivedBeacon();
173 return; 173 return;
174 } 174 }
175 } 175 }
176 else 176 else
177 { 177 {
178 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); 178 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
179 MLogWindow::logwindow()->log( s ); 179 MLogWindow::logwindow()->log( s );
180 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); 180 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe );
181 } 181 }
182 182
183 183
184 // insert new station as child from network 184 // insert new station as child from network
185 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 185 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
186 186
187 #ifdef DEBUG 187 #ifdef DEBUG
188 odebug << "inserting new station " << (const char*) macaddr << "" << oendl; 188 odebug << "inserting new station " << macaddr << "" << oendl;
189 #endif 189 #endif
190 190
191 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 191 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
192 station->setManufacturer( mac.manufacturer() ); 192 station->setManufacturer( mac.manufacturer() );
193 station->setLocation( loc.dmsPosition() ); 193 station->setLocation( loc.dmsPosition() );
194 194
195 if ( type == "managed" ) 195 if ( type == "managed" )
196 { 196 {
197 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); 197 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
198 } 198 }
199 else 199 else
200 { 200 {
@@ -202,59 +202,59 @@ void MScanListView::addNewItem( const QString& type,
202 } 202 }
203 MLogWindow::logwindow()->log( s ); 203 MLogWindow::logwindow()->log( s );
204} 204}
205 205
206 206
207void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) 207void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
208{ 208{
209 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 209 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
210 210
211 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) 211 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
212 { 212 {
213 #ifdef DEBUG 213 #ifdef DEBUG
214 odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl; 214 odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl;
215 #endif 215 #endif
216 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 216 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
217 } 217 }
218 218
219 if ( subitem ) 219 if ( subitem )
220 { 220 {
221 // we have already seen this item, it's a dupe 221 // we have already seen this item, it's a dupe
222 #ifdef DEBUG 222 #ifdef DEBUG
223 odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl; 223 odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl;
224 #endif 224 #endif
225 subitem->receivedBeacon(); //FIXME: sent data bit 225 subitem->receivedBeacon(); //FIXME: sent data bit
226 return; 226 return;
227 } 227 }
228 228
229 // Hey, it seems to be a new item :-D 229 // Hey, it seems to be a new item :-D
230 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); 230 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
231 station->setManufacturer( addr.manufacturer() ); 231 station->setManufacturer( addr.manufacturer() );
232 232
233 QString s; 233 QString s;
234 if ( type == "station" ) 234 if ( type == "station" )
235 { 235 {
236 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 236 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) );
237 } 237 }
238 else 238 else
239 { 239 {
240 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 240 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) );
241 } 241 }
242 MLogWindow::logwindow()->log( s ); 242 MLogWindow::logwindow()->log( s );
243} 243}
244 244
245 245
246void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) 246void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo )
247{ 247{
248 odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl; 248 odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl;
249 QString s; 249 QString s;
250 MScanListItem* network; 250 MScanListItem* network;
251 251
252 QListViewItemIterator it( this ); 252 QListViewItemIterator it( this );
253 while ( it.current() && 253 while ( it.current() &&
254 it.current()->text( col_ap ) != viaFrom.toString(true) && 254 it.current()->text( col_ap ) != viaFrom.toString(true) &&
255 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; 255 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it;
256 256
257 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 257 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
258 258
259 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations 259 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
260 { 260 {
@@ -314,70 +314,70 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t
314} 314}
315 315
316 316
317void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 317void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
318{ 318{
319 owarn << "D'oh! Not yet implemented..." << oendl; 319 owarn << "D'oh! Not yet implemented..." << oendl;
320 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); 320 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
321} 321}
322 322
323 323
324void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) 324void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
325{ 325{
326 odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; 326 odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl;
327 327
328 QListViewItemIterator it( this ); 328 QListViewItemIterator it( this );
329 for ( ; it.current(); ++it ) 329 for ( ; it.current(); ++it )
330 { 330 {
331 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 331 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
332 { 332 {
333 it.current()->setText( col_ip, ip ); 333 it.current()->setText( col_ip, ip );
334 return; 334 return;
335 } 335 }
336 } 336 }
337 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; 337 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
338 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", 338 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
339 (const char*) macaddr.toString(), (const char*) ip ) ); 339 (const char*) macaddr.toString(), (const char*) ip ) );
340} 340}
341 341
342 342
343void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) 343void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
344{ 344{
345 odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; 345 odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl;
346 346
347 //TODO: Refactor that out, we need it all over the place. 347 //TODO: Refactor that out, we need it all over the place.
348 // Best to do it in a more comfortable abstraction in OListView 348 // Best to do it in a more comfortable abstraction in OListView
349 // (Hmm, didn't I already start something in this direction?) 349 // (Hmm, didn't I already start something in this direction?)
350 350
351 QListViewItemIterator it( this ); 351 QListViewItemIterator it( this );
352 for ( ; it.current(); ++it ) 352 for ( ; it.current(); ++it )
353 { 353 {
354 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 354 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
355 { 355 {
356 356
357 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); 357 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
358 358
359 while ( subitem && ( subitem->text( col_essid ) != name ) ) 359 while ( subitem && ( subitem->text( col_essid ) != name ) )
360 { 360 {
361 #ifdef DEBUG 361 #ifdef DEBUG
362 odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl; 362 odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl;
363 #endif 363 #endif
364 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 364 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
365 } 365 }
366 366
367 if ( subitem ) 367 if ( subitem )
368 { 368 {
369 // we have already seen this item, it's a dupe 369 // we have already seen this item, it's a dupe
370 #ifdef DEBUG 370 #ifdef DEBUG
371 odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl; 371 odebug << "" << name << " is a dupe - ignoring..." << oendl;
372 #endif 372 #endif
373 subitem->receivedBeacon(); //FIXME: sent data bit 373 subitem->receivedBeacon(); //FIXME: sent data bit
374 return; 374 return;
375 } 375 }
376 376
377 // never seen that - add new item 377 // never seen that - add new item
378 378
379 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); 379 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
380 item->setText( col_essid, name ); 380 item->setText( col_essid, name );
381 381
382 return; 382 return;
383 } 383 }
@@ -546,22 +546,22 @@ void MScanListItem::setManufacturer( const QString& manufacturer )
546 546
547 547
548void MScanListItem::setLocation( const QString& location ) 548void MScanListItem::setLocation( const QString& location )
549{ 549{
550 setText( col_location, location ); 550 setText( col_location, location );
551} 551}
552 552
553 553
554void MScanListItem::receivedBeacon() 554void MScanListItem::receivedBeacon()
555{ 555{
556 _beacons++; 556 _beacons++;
557 #ifdef DEBUG 557 #ifdef DEBUG
558 odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl; 558 odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl;
559 #endif 559 #endif
560 setText( col_sig, QString::number( _beacons ) ); 560 setText( col_sig, QString::number( _beacons ) );
561 setText( col_lastseen, QTime::currentTime().toString() ); 561 setText( col_lastseen, QTime::currentTime().toString() );
562 562
563 MScanListItem* p = (MScanListItem*) parent(); 563 MScanListItem* p = (MScanListItem*) parent();
564 if ( p ) p->receivedBeacon(); 564 if ( p ) p->receivedBeacon();
565 565
566} 566}
567 567
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index fad6efd..822bde8 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -132,42 +132,42 @@ void Wellenreiter::channelHopped(int c)
132void Wellenreiter::handleNotification( OPacket* p ) 132void Wellenreiter::handleNotification( OPacket* p )
133{ 133{
134 QObjectList* l = p->queryList(); 134 QObjectList* l = p->queryList();
135 QObjectListIt it( *l ); 135 QObjectListIt it( *l );
136 QObject* o; 136 QObject* o;
137 137
138 while ( (o = it.current()) != 0 ) 138 while ( (o = it.current()) != 0 )
139 { 139 {
140 QString name = it.current()->name(); 140 QString name = it.current()->name();
141 if ( configwindow->parsePackets->isProtocolChecked( name ) ) 141 if ( configwindow->parsePackets->isProtocolChecked( name ) )
142 { 142 {
143 QString action = configwindow->parsePackets->protocolAction( name ); 143 QString action = configwindow->parsePackets->protocolAction( name );
144 odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; 144 odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl;
145 doAction( action, name, p ); 145 doAction( action, name, p );
146 } 146 }
147 else 147 else
148 { 148 {
149 odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl; 149 odebug << "protocol '" << name << "' not checked in parsePackets." << oendl;
150 } 150 }
151 ++it; 151 ++it;
152 } 152 }
153} 153}
154 154
155 155
156void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) 156void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
157{ 157{
158 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); 158 if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage );
159 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); 159 else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage );
160 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); 160 else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage );
161 else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl; 161 else owarn << "Wellenreiter::handleManagementFrame(): '" << manage->managementType() << "' - please handle me!" << oendl;
162} 162}
163 163
164 164
165void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) 165void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request )
166{ 166{
167 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 167 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
168 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); 168 QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
169 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 169 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
170 int channel = ds ? ds->channel() : -1; 170 int channel = ds ? ds->channel() : -1;
171 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 171 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
172 172
173 GpsLocation loc( -111, -111 ); 173 GpsLocation loc( -111, -111 );
@@ -238,25 +238,25 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa
238 238
239 239
240void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) 240void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
241{ 241{
242 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 242 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
243 243
244 if ( control->controlType() == "Acknowledge" ) 244 if ( control->controlType() == "Acknowledge" )
245 { 245 {
246 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); 246 netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) );
247 } 247 }
248 else 248 else
249 { 249 {
250 odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl; 250 odebug << "Wellenreiter::handleControlFrame - please handle " << control->controlType() << " in a future version! :D" << oendl;
251 } 251 }
252} 252}
253 253
254 254
255void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) 255void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
256{ 256{
257 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 257 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
258 if ( wlan->fromDS() && !wlan->toDS() ) 258 if ( wlan->fromDS() && !wlan->toDS() )
259 { 259 {
260 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 260 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
261 from = wlan->macAddress3(); 261 from = wlan->macAddress3();
262 to = wlan->macAddress2(); 262 to = wlan->macAddress2();
@@ -287,55 +287,55 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd
287 from = data->sourceAddress(); 287 from = data->sourceAddress();
288 to = data->destinationAddress(); 288 to = data->destinationAddress();
289 289
290 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); 290 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) );
291} 291}
292 292
293 293
294void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) 294void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
295{ 295{
296 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 296 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
297 if ( arp ) 297 if ( arp )
298 { 298 {
299 odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl; 299 odebug << "Received ARP traffic (type '" << arp->type() << "'): " << oendl;
300 if ( arp->type() == "REQUEST" ) 300 if ( arp->type() == "REQUEST" )
301 { 301 {
302 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 302 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
303 } 303 }
304 else if ( arp->type() == "REPLY" ) 304 else if ( arp->type() == "REPLY" )
305 { 305 {
306 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 306 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
307 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); 307 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
308 } 308 }
309 } 309 }
310} 310}
311 311
312 312
313void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) 313void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest )
314{ 314{
315 //TODO: Implement more IP based protocols 315 //TODO: Implement more IP based protocols
316 316
317 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); 317 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
318 if ( dhcp ) 318 if ( dhcp )
319 { 319 {
320 odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl; 320 odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl;
321 if ( dhcp->type() == "OFFER" ) 321 if ( dhcp->type() == "OFFER" )
322 { 322 {
323 odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; 323 odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl;
324 netView()->identify( source, dhcp->serverAddress().toString() ); 324 netView()->identify( source, dhcp->serverAddress().toString() );
325 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); 325 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() );
326 } 326 }
327 else if ( dhcp->type() == "ACK" ) 327 else if ( dhcp->type() == "ACK" )
328 { 328 {
329 odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; 329 odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl;
330 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); 330 netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() );
331 } 331 }
332 } 332 }
333} 333}
334 334
335 335
336QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) 336QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
337{ 337{
338 if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) 338 if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
339 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) 339 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
340 return 0; 340 return 0;
341 341
@@ -351,34 +351,34 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
351 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter 351 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
352 352
353 QObjectList* l = p->queryList(); 353 QObjectList* l = p->queryList();
354 QObjectListIt it( *l ); 354 QObjectListIt it( *l );
355 QObject* o; 355 QObject* o;
356 356
357 while ( (o = it.current()) != 0 ) 357 while ( (o = it.current()) != 0 )
358 { 358 {
359 QString name = it.current()->name(); 359 QString name = it.current()->name();
360 if ( configwindow->capturePackets->isProtocolChecked( name ) ) 360 if ( configwindow->capturePackets->isProtocolChecked( name ) )
361 { 361 {
362 QString action = configwindow->capturePackets->protocolAction( name ); 362 QString action = configwindow->capturePackets->protocolAction( name );
363 odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; 363 odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl;
364 if ( action == "Discard" ) 364 if ( action == "Discard" )
365 { 365 {
366 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); 366 logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) );
367 return false; 367 return false;
368 } 368 }
369 } 369 }
370 else 370 else
371 { 371 {
372 odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl; 372 odebug << "protocol '" << name << "' not checked in capturePackets." << oendl;
373 } 373 }
374 ++it; 374 ++it;
375 } 375 }
376 return true; 376 return true;
377} 377}
378 378
379 379
380void Wellenreiter::receivePacket( OPacket* p ) 380void Wellenreiter::receivePacket( OPacket* p )
381{ 381{
382 hexWindow()->add( p ); 382 hexWindow()->add( p );
383 383
384 if ( checkDumpPacket( p ) ) 384 if ( checkDumpPacket( p ) )
@@ -534,70 +534,70 @@ void Wellenreiter::startClicked()
534 } 534 }
535 } 535 }
536 // set monitor mode 536 // set monitor mode
537 bool usePrism = configwindow->usePrismHeader(); 537 bool usePrism = configwindow->usePrismHeader();
538 538
539 switch ( cardtype ) 539 switch ( cardtype )
540 { 540 {
541 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 541 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
542 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 542 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
543 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; 543 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
544 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; 544 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
545 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; 545 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
546 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break; 546 case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << interface << "'" << oendl; break;
547 default: assert( 0 ); // shouldn't reach this 547 default: assert( 0 ); // shouldn't reach this
548 } 548 }
549 549
550 // switch device into monitor mode 550 // switch device into monitor mode
551 if ( cardtype < DEVTYPE_FILE ) 551 if ( cardtype < DEVTYPE_FILE )
552 { 552 {
553 if ( cardtype != DEVTYPE_MANUAL ) 553 if ( cardtype != DEVTYPE_MANUAL )
554 iface->setMode( "monitor" ); 554 iface->setMode( "monitor" );
555 if ( iface->mode() != "monitor" ) 555 if ( iface->mode() != "monitor" )
556 { 556 {
557 if ( QMessageBox::warning( this, "Wellenreiter II", 557 if ( QMessageBox::warning( this, "Wellenreiter II",
558 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + 558 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
559 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 559 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
560 return; 560 return;
561 } 561 }
562 } 562 }
563 563
564 // open GPS device 564 // open GPS device
565 if ( configwindow->enableGPS->isChecked() ) 565 if ( configwindow->enableGPS->isChecked() )
566 { 566 {
567 odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; 567 odebug << "Wellenreiter:GPS enabled @ " << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl;
568 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 568 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
569 } 569 }
570 570
571 // open pcap and start sniffing 571 // open pcap and start sniffing
572 572
573 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? 573 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
574 { 574 {
575 dumpname = configwindow->captureFileName->text(); 575 dumpname = configwindow->captureFileName->text();
576 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 576 if ( dumpname.isEmpty() ) dumpname = "captureFile";
577 dumpname.append( '-' ); 577 dumpname.append( '-' );
578 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 578 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
579 dumpname.append( ".wellenreiter" ); 579 dumpname.append( ".wellenreiter" );
580 } 580 }
581 else // write it anyway ;) 581 else // write it anyway ;)
582 { 582 {
583 dumpname = "/var/log/dump.wellenreiter"; 583 dumpname = "/var/log/dump.wellenreiter";
584 } 584 }
585 585
586 if ( cardtype != DEVTYPE_FILE ) 586 if ( cardtype != DEVTYPE_FILE )
587 pcap->open( interface ); 587 pcap->open( interface );
588 else 588 else
589 pcap->open( QFile( interface ) ); 589 pcap->open( QFile( interface ) );
590 590
591 odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl; 591 odebug << "Wellenreiter:: dumping to " << dumpname << "" << oendl;
592 pcap->openDumpFile( dumpname ); 592 pcap->openDumpFile( dumpname );
593 593
594 if ( !pcap->isOpen() ) 594 if ( !pcap->isOpen() )
595 { 595 {
596 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 596 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
597 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 597 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
598 return; 598 return;
599 } 599 }
600 600
601 // set capturer to non-blocking mode 601 // set capturer to non-blocking mode
602 pcap->setBlocking( false ); 602 pcap->setBlocking( false );
603 603