author | mickeyl <mickeyl> | 2004-01-08 17:26:01 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-08 17:26:01 (UTC) |
commit | c0a0d53fb92f8a1723c57580a5fd0ade66574ec4 (patch) (unidiff) | |
tree | 0d1cb64ad905b81a04bd8c45cada4feda3c122f6 | |
parent | 9634c11f8ea28af19a4afc6821c68cdc2b3e7c8a (diff) | |
download | opie-c0a0d53fb92f8a1723c57580a5fd0ade66574ec4.zip opie-c0a0d53fb92f8a1723c57580a5fd0ade66574ec4.tar.gz opie-c0a0d53fb92f8a1723c57580a5fd0ade66574ec4.tar.bz2 |
Display stations sending out named ProbeRequests.
Wellenreiter II reaches a critical point in its lifetime, i.e.
the scanlist and wellenreiter classes are the mainly still as they
were during the early prototype phrase. It's time to rewrite the major
UI core and start with giving it something like a design (D'Oh!)...
-rw-r--r-- | noncore/net/wellenreiter/ChangeLog | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 20 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 7 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 39 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 5 |
5 files changed, 60 insertions, 16 deletions
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog index d4dca9f..f183d80 100644 --- a/noncore/net/wellenreiter/ChangeLog +++ b/noncore/net/wellenreiter/ChangeLog | |||
@@ -1,20 +1,21 @@ | |||
1 | 2004-??-?? Michael Lauer <mickey@Vanille.de> | 1 | 2004-??-?? Michael Lauer <mickey@Vanille.de> |
2 | 2 | ||
3 | * Added parsing of named ProbeRequests. Display only-probed-yet SSIDs in a different network color. | ||
3 | * Rewrote the simple actions on new {Network, Client, Station}. Besides playing a sound or | 4 | * Rewrote the simple actions on new {Network, Client, Station}. Besides playing a sound or |
4 | blinking a LED, a user customizable script can now be executed, if something has been | 5 | blinking a LED, a user customizable script can now be executed, if something has been |
5 | detected. This opens up many possibilities, i.e. a qcop to qpegps or exec'ing Flite. | 6 | detected. This opens up many possibilities, i.e. a qcop to qpegps or exec'ing flite (speech). |
6 | * Added decloaking of cloaked ESSIDs (length != 0, but essid[0] == \0) | 7 | * Added decloaking of cloaked ESSIDs (length != 0, but essid[0] == \0) |
7 | * Hided the 'Parse' Tab in the configuration window. Not functional now and may come later | 8 | * Hided the 'Parse' Tab in the configuration window. Not functional now and may come later |
8 | * Added parsing of control frames. Display stations sending them SSID "???" for now. | 9 | * Added parsing of control frames. Display stations sending them SSID "<unknown>" for now. |
9 | * Added command line option "-nocheck" to skip non-root and dhcp tests | 10 | * Added command line option "-nocheck" to skip non-root and dhcp tests |
10 | * Improved the speed reading the manufacturer list | 11 | * Improved the speed reading the manufacturer list |
11 | * GPS coordinates are now presented in the DMS (as opposed to decimal) format | 12 | * GPS coordinates are now presented in the DMS (as opposed to decimal) format |
12 | 13 | ||
13 | 2003-12-18 Michael Lauer <mickey@Vanille.de> | 14 | 2003-12-18 Michael Lauer <mickey@Vanille.de> |
14 | 15 | ||
15 | * Released as Version 1.0.2 (Development Snapshot) | 16 | * Released as Version 1.0.2 (Development Snapshot) |
16 | * Added automatic uploading of capture files to "The Capture Dump" site at | 17 | * Added automatic uploading of capture files to "The Capture Dump" site at |
17 | http://www.Vanille.de/projects/capturedump.spy | 18 | http://www.Vanille.de/projects/capturedump.spy |
18 | * Initial reading of the manufacturer database happens now in background | 19 | * Initial reading of the manufacturer database happens now in background |
19 | * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now. | 20 | * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now. |
20 | The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that | 21 | The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index aea7eb6..fd88b63 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -111,25 +111,26 @@ void MScanListView::serializeFrom( QDataStream& s) | |||
111 | { | 111 | { |
112 | qDebug( "serializing MScanListView" ); | 112 | qDebug( "serializing MScanListView" ); |
113 | OListView::serializeFrom( s ); | 113 | OListView::serializeFrom( s ); |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | void MScanListView::addNewItem( const QString& type, | 117 | void MScanListView::addNewItem( const QString& type, |
118 | const QString& essid, | 118 | const QString& essid, |
119 | const OMacAddress& mac, | 119 | const OMacAddress& mac, |
120 | bool wep, | 120 | bool wep, |
121 | int channel, | 121 | int channel, |
122 | int signal, | 122 | int signal, |
123 | const GpsLocation& loc ) | 123 | const GpsLocation& loc, |
124 | bool probe ) | ||
124 | { | 125 | { |
125 | QString macaddr = mac.toString(true); | 126 | QString macaddr = mac.toString(true); |
126 | 127 | ||
127 | #ifdef DEBUG | 128 | #ifdef DEBUG |
128 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, | 129 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, |
129 | (const char*) essid, (const char*) macaddr, channel ); | 130 | (const char*) essid, (const char*) macaddr, channel ); |
130 | #endif | 131 | #endif |
131 | 132 | ||
132 | // search, if we already have seen this net | 133 | // search, if we already have seen this net |
133 | 134 | ||
134 | QString s; | 135 | QString s; |
135 | MScanListItem* network; | 136 | MScanListItem* network; |
@@ -164,49 +165,48 @@ void MScanListView::addNewItem( const QString& type, | |||
164 | // we have already seen this item, it's a dupe | 165 | // we have already seen this item, it's a dupe |
165 | #ifdef DEBUG | 166 | #ifdef DEBUG |
166 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 167 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
167 | #endif | 168 | #endif |
168 | item->receivedBeacon(); | 169 | item->receivedBeacon(); |
169 | return; | 170 | return; |
170 | } | 171 | } |
171 | } | 172 | } |
172 | else | 173 | else |
173 | { | 174 | { |
174 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 175 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
175 | MLogWindow::logwindow()->log( s ); | 176 | MLogWindow::logwindow()->log( s ); |
176 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); | 177 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); |
177 | } | 178 | } |
178 | 179 | ||
179 | 180 | ||
180 | // insert new station as child from network | 181 | // insert new station as child from network |
181 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 182 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
182 | 183 | ||
183 | #ifdef DEBUG | 184 | #ifdef DEBUG |
184 | qDebug( "inserting new station %s", (const char*) macaddr ); | 185 | qDebug( "inserting new station %s", (const char*) macaddr ); |
185 | #endif | 186 | #endif |
186 | 187 | ||
187 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 188 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
188 | station->setManufacturer( mac.manufacturer() ); | 189 | station->setManufacturer( mac.manufacturer() ); |
189 | station->setLocation( loc.dmsPosition() ); | 190 | station->setLocation( loc.dmsPosition() ); |
190 | 191 | ||
191 | if ( type == "managed" ) | 192 | if ( type == "managed" ) |
192 | { | 193 | { |
193 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 194 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
194 | } | 195 | } |
195 | else | 196 | else |
196 | { | 197 | { |
197 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 198 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
198 | } | 199 | } |
199 | MLogWindow::logwindow()->log( s ); | 200 | MLogWindow::logwindow()->log( s ); |
200 | |||
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 204 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
205 | { | 205 | { |
206 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 206 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
207 | 207 | ||
208 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 208 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
209 | { | 209 | { |
210 | #ifdef DEBUG | 210 | #ifdef DEBUG |
211 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 211 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
212 | #endif | 212 | #endif |
@@ -401,47 +401,47 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in | |||
401 | m.insertItem( entry, 37773, 0 ); | 401 | m.insertItem( entry, 37773, 0 ); |
402 | int result = m.exec( QCursor::pos() ); | 402 | int result = m.exec( QCursor::pos() ); |
403 | if ( result == 37773 ) | 403 | if ( result == 37773 ) |
404 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | 404 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | //============================================================ | 408 | //============================================================ |
409 | // MScanListItem | 409 | // MScanListItem |
410 | //============================================================ | 410 | //============================================================ |
411 | 411 | ||
412 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, | 412 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, |
413 | bool wep, int channel, int signal ) | 413 | bool wep, int channel, int signal, bool probed ) |
414 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 414 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
415 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 415 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
416 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 416 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
417 | { | 417 | { |
418 | #ifdef DEBUG | 418 | #ifdef DEBUG |
419 | qDebug( "creating scanlist item" ); | 419 | qDebug( "creating scanlist item" ); |
420 | #endif | 420 | #endif |
421 | 421 | ||
422 | if ( WellenreiterConfigWindow::instance() ) | 422 | if ( WellenreiterConfigWindow::instance() ) |
423 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 423 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
424 | 424 | ||
425 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 425 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); |
426 | } | 426 | } |
427 | 427 | ||
428 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, | 428 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, |
429 | bool wep, int channel, int signal ) | 429 | bool wep, int channel, int signal ) |
430 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 430 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
431 | { | 431 | { |
432 | #ifdef DEBUG | 432 | #ifdef DEBUG |
433 | qDebug( "creating scanlist item" ); | 433 | qDebug( "creating scanlist item" ); |
434 | #endif | 434 | #endif |
435 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 435 | decorateItem( type, essid, macaddr, wep, channel, signal, false ); |
436 | } | 436 | } |
437 | 437 | ||
438 | const QString& MScanListItem::essid() const | 438 | const QString& MScanListItem::essid() const |
439 | { | 439 | { |
440 | if ( type == "network" ) | 440 | if ( type == "network" ) |
441 | return _essid; | 441 | return _essid; |
442 | else | 442 | else |
443 | return ( (MScanListItem*) parent() )->essid(); | 443 | return ( (MScanListItem*) parent() )->essid(); |
444 | } | 444 | } |
445 | 445 | ||
446 | OListViewItem* MScanListItem::childFactory() | 446 | OListViewItem* MScanListItem::childFactory() |
447 | { | 447 | { |
@@ -470,39 +470,45 @@ void MScanListItem::serializeFrom( QDataStream& s ) | |||
470 | s >> _type; | 470 | s >> _type; |
471 | s >> (Q_UINT8) wep; | 471 | s >> (Q_UINT8) wep; |
472 | _wep = (wep == 'y'); | 472 | _wep = (wep == 'y'); |
473 | 473 | ||
474 | QString name; | 474 | QString name; |
475 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 475 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
476 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 476 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
477 | if ( _wep ) | 477 | if ( _wep ) |
478 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 478 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
479 | listView()->triggerUpdate(); | 479 | listView()->triggerUpdate(); |
480 | } | 480 | } |
481 | 481 | ||
482 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 482 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) |
483 | { | 483 | { |
484 | #ifdef DEBUG | 484 | #ifdef DEBUG |
485 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 485 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
486 | (const char*) type, | 486 | (const char*) type, |
487 | (const char*) essid, | 487 | (const char*) essid, |
488 | (const char*) macaddr, | 488 | (const char*) macaddr, |
489 | channel ); | 489 | channel ); |
490 | #endif | 490 | #endif |
491 | 491 | ||
492 | // set icon for managed or adhoc mode | 492 | // set icon for managed or adhoc mode |
493 | QString name; | 493 | QString name; |
494 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 494 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
495 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 495 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
496 | 496 | ||
497 | // special case for probed networks FIXME: This is ugly at present | ||
498 | if ( type == "network" && probed ) | ||
499 | { | ||
500 | setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); | ||
501 | } | ||
502 | |||
497 | // set icon for wep (wireless encryption protocol) | 503 | // set icon for wep (wireless encryption protocol) |
498 | if ( wep ) | 504 | if ( wep ) |
499 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 505 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
500 | 506 | ||
501 | // set channel and signal text | 507 | // set channel and signal text |
502 | 508 | ||
503 | if ( signal != -1 ) | 509 | if ( signal != -1 ) |
504 | setText( col_sig, QString::number( signal ) ); | 510 | setText( col_sig, QString::number( signal ) ); |
505 | if ( channel != -1 ) | 511 | if ( channel != -1 ) |
506 | setText( col_channel, QString::number( channel ) ); | 512 | setText( col_channel, QString::number( channel ) ); |
507 | 513 | ||
508 | setText( col_firstseen, QTime::currentTime().toString() ); | 514 | setText( col_firstseen, QTime::currentTime().toString() ); |
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index e8d48c3..cbacdee 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -32,25 +32,25 @@ class 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&, const OMacAddress&, bool, int, int, const GpsLocation&, bool = false ); |
45 | void addService( const QString& name, const OMacAddress& macaddr, const QString& ip ); | 45 | void addService( const QString& name, const OMacAddress& macaddr, const QString& ip ); |
46 | 46 | ||
47 | void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); | 47 | void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); |
48 | void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); | 48 | void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); |
49 | 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 ); |
50 | void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); | 50 | void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); |
51 | 51 | ||
52 | void identify( const OMacAddress&, const QString& ipaddr ); | 52 | void identify( const OMacAddress&, const QString& ipaddr ); |
53 | 53 | ||
54 | void contextMenuRequested( QListViewItem* item, const QPoint&, int ); | 54 | void contextMenuRequested( QListViewItem* item, const QPoint&, int ); |
55 | 55 | ||
56 | signals: | 56 | signals: |
@@ -64,37 +64,38 @@ class MScanListView: public OListView | |||
64 | 64 | ||
65 | //****************************** MScanListItem **************************************************************** | 65 | //****************************** MScanListItem **************************************************************** |
66 | 66 | ||
67 | class MScanListItem: public OListViewItem | 67 | class MScanListItem: public OListViewItem |
68 | { | 68 | { |
69 | public: | 69 | public: |
70 | MScanListItem::MScanListItem( QListView* parent, | 70 | MScanListItem::MScanListItem( QListView* parent, |
71 | const QString& type = "unknown", | 71 | const QString& type = "unknown", |
72 | const QString& essid = "unknown", | 72 | const QString& essid = "unknown", |
73 | const QString& macaddr = "unknown", | 73 | const QString& macaddr = "unknown", |
74 | bool wep = false, | 74 | bool wep = false, |
75 | int channel = 0, | 75 | int channel = 0, |
76 | int signal = 0 ); | 76 | int signal = 0, |
77 | bool probed = false ); | ||
77 | 78 | ||
78 | MScanListItem::MScanListItem( QListViewItem* parent, | 79 | MScanListItem::MScanListItem( QListViewItem* parent, |
79 | const QString& type = "unknown", | 80 | const QString& type = "unknown", |
80 | const QString& essid = "unknown", | 81 | const QString& essid = "unknown", |
81 | const QString& macaddr = "unknown", | 82 | const QString& macaddr = "unknown", |
82 | bool wep = false, | 83 | bool wep = false, |
83 | int channel = 0, | 84 | int channel = 0, |
84 | int signal = 0 ); | 85 | int signal = 0 ); |
85 | 86 | ||
86 | 87 | ||
87 | protected: | 88 | protected: |
88 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 89 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ); |
89 | 90 | ||
90 | public: | 91 | public: |
91 | QString type; | 92 | QString type; |
92 | 93 | ||
93 | public: | 94 | public: |
94 | //const QString& type() { return _type; }; | 95 | //const QString& type() { return _type; }; |
95 | const QString& essid() const; | 96 | const QString& essid() const; |
96 | const QString& macaddr() { return _macaddr; }; | 97 | const QString& macaddr() { return _macaddr; }; |
97 | bool wep() { return _wep; }; | 98 | bool wep() { return _wep; }; |
98 | int channel() { return _channel; }; | 99 | int channel() { return _channel; }; |
99 | int signal() { return _signal; }; | 100 | int signal() { return _signal; }; |
100 | int beacons() { return _beacons; }; | 101 | int beacons() { return _beacons; }; |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 25632f3..cd74bed 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -152,28 +152,61 @@ void Wellenreiter::handleNotification( OPacket* p ) | |||
152 | } | 152 | } |
153 | else | 153 | else |
154 | { | 154 | { |
155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 155 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); |
156 | } | 156 | } |
157 | ++it; | 157 | ++it; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) | 162 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
163 | { | 163 | { |
164 | if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time | 164 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); |
165 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); | ||
166 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); | ||
167 | else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); | ||
168 | } | ||
165 | 169 | ||
166 | OWaveLanManagementPacket* beacon = manage; | ||
167 | 170 | ||
171 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) | ||
172 | { | ||
173 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | ||
174 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | ||
175 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | ||
176 | int channel = ds ? ds->channel() : -1; | ||
177 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | ||
178 | |||
179 | GpsLocation loc( -111, -111 ); | ||
180 | if ( configwindow->enableGPS->isChecked() ) | ||
181 | { | ||
182 | // TODO: add check if GPS is working!? | ||
183 | qDebug( "Wellenreiter::gathering GPS data..." ); | ||
184 | loc = gps->position(); | ||
185 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | ||
186 | } | ||
187 | |||
188 | if ( essid.length() ) | ||
189 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); | ||
190 | qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); | ||
191 | } | ||
192 | |||
193 | |||
194 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) | ||
195 | { | ||
196 | } | ||
197 | |||
198 | |||
199 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | ||
200 | { | ||
168 | QString type; | 201 | QString type; |
169 | if ( beacon->canIBSS() ) | 202 | if ( beacon->canIBSS() ) |
170 | { | 203 | { |
171 | type = "adhoc"; | 204 | type = "adhoc"; |
172 | } | 205 | } |
173 | else if ( beacon->canESS() ) | 206 | else if ( beacon->canESS() ) |
174 | { | 207 | { |
175 | type = "managed"; | 208 | type = "managed"; |
176 | } | 209 | } |
177 | else | 210 | else |
178 | { | 211 | { |
179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 212 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
@@ -207,25 +240,25 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* | |||
207 | else | 240 | else |
208 | graphwindow->traffic( ds->channel(), 95 ); | 241 | graphwindow->traffic( ds->channel(), 95 ); |
209 | } | 242 | } |
210 | } | 243 | } |
211 | 244 | ||
212 | 245 | ||
213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | 246 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) |
214 | { | 247 | { |
215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 248 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
216 | 249 | ||
217 | if ( control->controlType() == "Acknowledge" ) | 250 | if ( control->controlType() == "Acknowledge" ) |
218 | { | 251 | { |
219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); | 252 | netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); |
220 | } | 253 | } |
221 | else | 254 | else |
222 | { | 255 | { |
223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | 256 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); |
224 | } | 257 | } |
225 | } | 258 | } |
226 | 259 | ||
227 | 260 | ||
228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 261 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
229 | { | 262 | { |
230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 263 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
231 | if ( wlan->fromDS() && !wlan->toDS() ) | 264 | if ( wlan->fromDS() && !wlan->toDS() ) |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 5414fda..a28740b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -66,25 +66,28 @@ class Wellenreiter : public WellenreiterBase { | |||
66 | void channelHopped(int); | 66 | void channelHopped(int); |
67 | void receivePacket(OPacket*); | 67 | void receivePacket(OPacket*); |
68 | void startClicked(); | 68 | void startClicked(); |
69 | void stopClicked(); | 69 | void stopClicked(); |
70 | 70 | ||
71 | void joinNetwork(const QString&,const QString&,int,const QString&); | 71 | void joinNetwork(const QString&,const QString&,int,const QString&); |
72 | 72 | ||
73 | signals: | 73 | signals: |
74 | void startedSniffing(); | 74 | void startedSniffing(); |
75 | void stoppedSniffing(); | 75 | void stoppedSniffing(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ); | 78 | void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* ); |
79 | void handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* ); | ||
80 | void handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* ); | ||
81 | void handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* ); | ||
79 | void handleControlFrame( OPacket* p, OWaveLanControlPacket* control ); | 82 | void handleControlFrame( OPacket* p, OWaveLanControlPacket* control ); |
80 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); | 83 | void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); |
81 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); | 84 | void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); |
82 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); | 85 | void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); |
83 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); | 86 | void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); |
84 | void handleNotification( OPacket* p ); | 87 | void handleNotification( OPacket* p ); |
85 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | 88 | void doAction( const QString& action, const QString& protocol, OPacket* p ); |
86 | QObject* childIfToParse( OPacket* p, const QString& protocol ); | 89 | QObject* childIfToParse( OPacket* p, const QString& protocol ); |
87 | bool checkDumpPacket( OPacket* p ); | 90 | bool checkDumpPacket( OPacket* p ); |
88 | 91 | ||
89 | private: | 92 | private: |
90 | #ifdef QWS | 93 | #ifdef QWS |