summaryrefslogtreecommitdiff
path: root/noncore
authormickeyl <mickeyl>2003-10-05 13:12:45 (UTC)
committer mickeyl <mickeyl>2003-10-05 13:12:45 (UTC)
commit634a68b636a0fa24232029b79ffa915a5621b2be (patch) (unidiff)
tree3e4c58bebfd624e841c314f1db68d985d81cdc6c /noncore
parentdc9510f788212a6be063349461540e4bea690f51 (diff)
downloadopie-634a68b636a0fa24232029b79ffa915a5621b2be.zip
opie-634a68b636a0fa24232029b79ffa915a5621b2be.tar.gz
opie-634a68b636a0fa24232029b79ffa915a5621b2be.tar.bz2
* start with preparations for scanning wired networks
* dhcp recognition now works nicely
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp48
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp64
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h7
4 files changed, 110 insertions, 10 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 245290d..9d6ed6a 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -318,48 +318,96 @@ void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to,
318 qWarning( "D'oh! Not yet implemented..." ); 318 qWarning( "D'oh! Not yet implemented..." );
319 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); 319 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
320} 320}
321 321
322 322
323void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) 323void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
324{ 324{
325 qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); 325 qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip );
326 326
327 QListViewItemIterator it( this ); 327 QListViewItemIterator it( this );
328 for ( ; it.current(); ++it ) 328 for ( ; it.current(); ++it )
329 { 329 {
330 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 330 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
331 { 331 {
332 it.current()->setText( col_ip, ip ); 332 it.current()->setText( col_ip, ip );
333 return; 333 return;
334 } 334 }
335 } 335 }
336 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 336 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
337 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", 337 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
338 (const char*) macaddr.toString(), (const char*) ip ) ); 338 (const char*) macaddr.toString(), (const char*) ip ) );
339} 339}
340 340
341 341
342void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
343{
344 qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip );
345
346 //TODO: Refactor that out, we need it all over the place.
347 // Best to do it in a more comfortable abstraction in OListView
348 // (Hmm, didn't I already start something in this direction?)
349
350 QListViewItemIterator it( this );
351 for ( ; it.current(); ++it )
352 {
353 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
354 {
355
356 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
357
358 while ( subitem && ( subitem->text( col_essid ) != name ) )
359 {
360 #ifdef DEBUG
361 qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) );
362 #endif
363 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
364 }
365
366 if ( subitem )
367 {
368 // we have already seen this item, it's a dupe
369 #ifdef DEBUG
370 qDebug( "%s is a dupe - ignoring...", (const char*) name );
371 #endif
372 subitem->receivedBeacon(); //FIXME: sent data bit
373 return;
374 }
375
376 // never seen that - add new item
377
378 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", false, -1, -1 );
379 item->setText( col_essid, name );
380
381 return;
382 }
383 }
384 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
385 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!",
386 (const char*) macaddr.toString(), (const char*) ip ) );
387}
388
389
342void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 390void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
343{ 391{
344 if ( !item ) return; 392 if ( !item ) return;
345 393
346 MScanListItem* itm = static_cast<MScanListItem*>( item ); 394 MScanListItem* itm = static_cast<MScanListItem*>( item );
347 395
348 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", 396 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'",
349 (const char*) itm->text(0), (const char*) itm->type, col ); 397 (const char*) itm->text(0), (const char*) itm->type, col );
350 398
351 if ( itm->type == "adhoc" || itm->type == "managed" ) 399 if ( itm->type == "adhoc" || itm->type == "managed" )
352 { 400 {
353 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); 401 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() );
354 402
355 QPopupMenu m( this ); 403 QPopupMenu m( this );
356 m.insertItem( entry, 37773, 0 ); 404 m.insertItem( entry, 37773, 0 );
357 int result = m.exec( QCursor::pos() ); 405 int result = m.exec( QCursor::pos() );
358 if ( result == 37773 ) 406 if ( result == 37773 )
359 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); 407 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
360 } 408 }
361} 409}
362 410
363//============================================================ 411//============================================================
364// MScanListItem 412// MScanListItem
365//============================================================ 413//============================================================
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 2703b6a..a9b74f1 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -21,48 +21,49 @@
21/* OPIE */ 21/* OPIE */
22#include <opie2/olistview.h> 22#include <opie2/olistview.h>
23#include <opie2/onetutils.h> 23#include <opie2/onetutils.h>
24 24
25/* QT */ 25/* QT */
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28class QString; 28class QString;
29class MScanListItem; 29class MScanListItem;
30 30
31class MScanListView: public OListView 31class MScanListView: public OListView
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35 public: 35 public:
36 MScanListView( QWidget* parent = 0, const char* name = 0 ); 36 MScanListView( QWidget* parent = 0, const char* name = 0 );
37 virtual ~MScanListView(); 37 virtual ~MScanListView();
38 38
39 virtual OListViewItem* childFactory(); 39 virtual OListViewItem* childFactory();
40 virtual void serializeTo( QDataStream& s ) const; 40 virtual void serializeTo( QDataStream& s ) const;
41 virtual void serializeFrom( QDataStream& s ); 41 virtual void serializeFrom( QDataStream& s );
42 42
43 public slots: 43 public slots:
44 void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location ); 44 void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location );
45 void addService( const QString& name, const OMacAddress& macaddr, const QString& ip );
45 46
46 void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 47 void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
47 void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 48 void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
48 void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ); 49 void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo );
49 void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 50 void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
50 51
51 void identify( const OMacAddress&, const QString& ipaddr ); 52 void identify( const OMacAddress&, const QString& ipaddr );
52 53
53 void contextMenuRequested( QListViewItem* item, const QPoint&, int ); 54 void contextMenuRequested( QListViewItem* item, const QPoint&, int );
54 55
55 signals: 56 signals:
56 void rightButtonClicked(QListViewItem*,const QPoint&,int); 57 void rightButtonClicked(QListViewItem*,const QPoint&,int);
57 void joinNetwork( const QString&, const QString&, int, const QString& ); 58 void joinNetwork( const QString&, const QString&, int, const QString& );
58 59
59 protected: 60 protected:
60 void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" ); 61 void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" );
61 62
62}; 63};
63 64
64//****************************** MScanListItem **************************************************************** 65//****************************** MScanListItem ****************************************************************
65 66
66class MScanListItem: public OListViewItem 67class MScanListItem: public OListViewItem
67{ 68{
68 public: 69 public:
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 405eda8..7394742 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -173,87 +173,116 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
173 173
174 GpsLocation loc( 0, 0 ); 174 GpsLocation loc( 0, 0 );
175 if ( configwindow->enableGPS->isChecked() ) 175 if ( configwindow->enableGPS->isChecked() )
176 { 176 {
177 // TODO: add check if GPS is working!? 177 // TODO: add check if GPS is working!?
178 qDebug( "Wellenreiter::gathering GPS data..." ); 178 qDebug( "Wellenreiter::gathering GPS data..." );
179 loc = gps->position(); 179 loc = gps->position();
180 qDebug( "Wellenreiter::GPS data received is ( %f , %f )", loc.latitude, loc.longitude ); 180 qDebug( "Wellenreiter::GPS data received is ( %f , %f )", loc.latitude, loc.longitude );
181 } 181 }
182 182
183 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); 183 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
184 184
185 // update graph window 185 // update graph window
186 if ( ds ) 186 if ( ds )
187 { 187 {
188 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); 188 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
189 if ( prism ) 189 if ( prism )
190 graphwindow->traffic( ds->channel(), prism->signalStrength() ); 190 graphwindow->traffic( ds->channel(), prism->signalStrength() );
191 else 191 else
192 graphwindow->traffic( ds->channel(), 95 ); 192 graphwindow->traffic( ds->channel(), 95 );
193 } 193 }
194} 194}
195 195
196 196
197void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) 197void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
198{ 198{
199 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 199 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
200 if ( wlan->fromDS() && !wlan->toDS() ) 200 if ( wlan->fromDS() && !wlan->toDS() )
201 { 201 {
202 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 202 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
203 from = wlan->macAddress3();
204 to = wlan->macAddress2();
203 } 205 }
204 else if ( !wlan->fromDS() && wlan->toDS() ) 206 else if ( !wlan->fromDS() && wlan->toDS() )
205 { 207 {
206 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); 208 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
209 from = wlan->macAddress2();
210 to = wlan->macAddress3();
207 } 211 }
208 else if ( wlan->fromDS() && wlan->toDS() ) 212 else if ( wlan->fromDS() && wlan->toDS() )
209 { 213 {
210 netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 214 netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
215 from = wlan->macAddress4();
216 to = wlan->macAddress3();
211 } 217 }
212 else 218 else
213 { 219 {
214 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); 220 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
221 from = wlan->macAddress2();
222 to = wlan->macAddress1();
215 } 223 }
224}
225
226
227void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to )
228{
229 from = data->sourceAddress();
230 to = data->destinationAddress();
231
232 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) );
233}
234
216 235
236void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest )
237{
217 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 238 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
218 if ( arp ) 239 if ( arp )
219 { 240 {
220 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); 241 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() );
221 if ( arp->type() == "REQUEST" ) 242 if ( arp->type() == "REQUEST" )
222 { 243 {
223 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 244 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
224 } 245 }
225 else if ( arp->type() == "REPLY" ) 246 else if ( arp->type() == "REPLY" )
226 { 247 {
227 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 248 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
228 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); 249 netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
229 } 250 }
230 } 251 }
231 252
232 OIPPacket* ip = (OIPPacket*) p->child( "IP" ); 253 ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
233 if ( ip ) 254 if ( dhcp )
255 {
256 qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() );
257 if ( dhcp->type() == "OFFER" )
234 { 258 {
235 qDebug( "Received IP packet." ); 259 qDebug( "ADDSERVICE: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() );
260 //netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) );
261
262 netView()->identify( source, dhcp->serverAddress().toString() );
263 netView()->addService( "DHCP", source, dhcp->serverAddress().toString() );
264 }
236 } 265 }
237} 266}
238 267
239 268
240QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) 269QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
241{ 270{
242 if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) 271 if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
243 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) 272 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
244 return 0; 273 return 0;
245 274
246 return p->child( protocol ); 275 return p->child( protocol );
247} 276}
248 277
249 278
250bool Wellenreiter::checkDumpPacket( OPacket* p ) 279bool Wellenreiter::checkDumpPacket( OPacket* p )
251{ 280{
252 // go through all child packets and see if one is inside the child hierarchy for p 281 // go through all child packets and see if one is inside the child hierarchy for p
253 // if so, do what the user requested (protocolAction), e.g. pass or discard 282 // if so, do what the user requested (protocolAction), e.g. pass or discard
254 if ( !configwindow->writeCaptureFile->isChecked() ) 283 if ( !configwindow->writeCaptureFile->isChecked() )
255 return false; 284 return false;
256 285
257 QObjectList* l = p->queryList(); 286 QObjectList* l = p->queryList();
258 QObjectListIt it( *l ); 287 QObjectListIt it( *l );
259 QObject* o; 288 QObject* o;
@@ -277,58 +306,75 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
277 } 306 }
278 ++it; 307 ++it;
279 } 308 }
280 return true; 309 return true;
281} 310}
282 311
283 312
284void Wellenreiter::receivePacket( OPacket* p ) 313void Wellenreiter::receivePacket( OPacket* p )
285{ 314{
286 hexWindow()->log( p->dump( 8 ) ); 315 hexWindow()->log( p->dump( 8 ) );
287 316
288 if ( checkDumpPacket( p ) ) 317 if ( checkDumpPacket( p ) )
289 { 318 {
290 pcap->dump( p ); 319 pcap->dump( p );
291 } 320 }
292 321
293 // check if we received a beacon frame 322 // check if we received a beacon frame
294 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); 323 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
295 if ( beacon && beacon->managementType() == "Beacon" ) 324 if ( beacon && beacon->managementType() == "Beacon" )
296 { 325 {
297 handleBeacon( p, beacon ); 326 handleBeacon( p, beacon );
298 return; 327 return;
299 } 328 }
300 329
330 OMacAddress source;
331 OMacAddress dest;
332
301 //TODO: WEP check here 333 //TODO: WEP check here
302 334
303 // check for a data frame 335 // check for a wireless data frame
304 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); 336 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
305 if ( data ) 337 if ( wlan )
338 {
339 handleWlanData( p, wlan, source, dest );
340 }
341
342 // check for a wired data frame
343 OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) );
344 if ( eth )
345 {
346 handleEthernetData( p, eth, source, dest );
347 }
348
349 // check for a ip frame
350 OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) );
351 if ( ip )
306 { 352 {
307 handleData( p, data ); 353 handleIPData( p, ip, source, dest );
308 } 354 }
309 355
310 handleNotification( p ); 356 //handleNotification( p );
311 357
312} 358}
313 359
314 360
315void Wellenreiter::stopClicked() 361void Wellenreiter::stopClicked()
316{ 362{
317 if ( iface ) 363 if ( iface )
318 { 364 {
319 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 365 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
320 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 366 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
321 iface->setChannelHopping(); // stop hopping channels 367 iface->setChannelHopping(); // stop hopping channels
322 } 368 }
323 else 369 else
324 killTimers(); 370 killTimers();
325 371
326 pcap->close(); 372 pcap->close();
327 sniffing = false; 373 sniffing = false;
328 374
329 if ( iface ) 375 if ( iface )
330 { 376 {
331 // switch off monitor mode 377 // switch off monitor mode
332 iface->setMonitorMode( false ); 378 iface->setMonitorMode( false );
333 // switch off promisc flag 379 // switch off promisc flag
334 iface->setPromiscuousMode( false ); 380 iface->setPromiscuousMode( false );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 43f6f99..ed96375 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -7,87 +7,92 @@
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26class QTimerEvent; 26class QTimerEvent;
27class QPixmap; 27class QPixmap;
28class OPacket; 28class OPacket;
29class OWaveLanManagementPacket; 29class OWaveLanManagementPacket;
30class OWaveLanDataPacket; 30class OWaveLanDataPacket;
31class OEthernetPacket;
32class OMacAddress;
33class OIPPacket;
31class OPacketCapturer; 34class OPacketCapturer;
32class OWirelessNetworkInterface; 35class OWirelessNetworkInterface;
33class WellenreiterConfigWindow; 36class WellenreiterConfigWindow;
34class MLogWindow; 37class MLogWindow;
35class MHexWindow; 38class MHexWindow;
36class GPS; 39class GPS;
37 40
38class Wellenreiter : public WellenreiterBase { 41class Wellenreiter : public WellenreiterBase {
39 Q_OBJECT 42 Q_OBJECT
40 43
41 public: 44 public:
42 Wellenreiter( QWidget* parent = 0 ); 45 Wellenreiter( QWidget* parent = 0 );
43 ~Wellenreiter(); 46 ~Wellenreiter();
44 47
45 void setConfigWindow( WellenreiterConfigWindow* cw ); 48 void setConfigWindow( WellenreiterConfigWindow* cw );
46 MScanListView* netView() const { return netview; }; 49 MScanListView* netView() const { return netview; };
47 MLogWindow* logWindow() const { return logwindow; }; 50 MLogWindow* logWindow() const { return logwindow; };
48 MHexWindow* hexWindow() const { return hexwindow; }; 51 MHexWindow* hexWindow() const { return hexwindow; };
49 bool isDaemonRunning() const { return sniffing; }; 52 bool isDaemonRunning() const { return sniffing; };
50 53
51 public: 54 public:
52 bool sniffing; 55 bool sniffing;
53 56
54 protected: 57 protected:
55 virtual void timerEvent( QTimerEvent* ); 58 virtual void timerEvent( QTimerEvent* );
56 59
57 public slots: 60 public slots:
58 void channelHopped(int); 61 void channelHopped(int);
59 void receivePacket(OPacket*); 62 void receivePacket(OPacket*);
60 void startClicked(); 63 void startClicked();
61 void stopClicked(); 64 void stopClicked();
62 65
63 void joinNetwork(const QString&,const QString&,int,const QString&); 66 void joinNetwork(const QString&,const QString&,int,const QString&);
64 67
65 signals: 68 signals:
66 void startedSniffing(); 69 void startedSniffing();
67 void stoppedSniffing(); 70 void stoppedSniffing();
68 71
69 private: 72 private:
70 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); 73 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon );
71 void handleData( OPacket* p, OWaveLanDataPacket* data ); 74 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to );
75 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to );
76 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to );
72 void handleNotification( OPacket* p ); 77 void handleNotification( OPacket* p );
73 void doAction( const QString& action, const QString& protocol, OPacket* p ); 78 void doAction( const QString& action, const QString& protocol, OPacket* p );
74 QObject* childIfToParse( OPacket* p, const QString& protocol ); 79 QObject* childIfToParse( OPacket* p, const QString& protocol );
75 bool checkDumpPacket( OPacket* p ); 80 bool checkDumpPacket( OPacket* p );
76 81
77 private: 82 private:
78 #ifdef QWS 83 #ifdef QWS
79 OSystem _system; // Opie Operating System identifier 84 OSystem _system; // Opie Operating System identifier
80 #endif 85 #endif
81 86
82 OWirelessNetworkInterface* iface; 87 OWirelessNetworkInterface* iface;
83 OPacketCapturer* pcap; 88 OPacketCapturer* pcap;
84 WellenreiterConfigWindow* configwindow; 89 WellenreiterConfigWindow* configwindow;
85 GPS* gps; 90 GPS* gps;
86 91
87 //void readConfig(); 92 //void readConfig();
88 //void writeConfig(); 93 //void writeConfig();
89}; 94};
90 95
91 96
92 97
93#endif 98#endif