-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,56 +1,57 @@ | |||
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 |
21 | doesn't work, it falls back to using the proprietary iwpriv commands | 22 | doesn't work, it falls back to using the proprietary iwpriv commands |
22 | 23 | ||
23 | 2003-11-30 Michael Lauer <mickey@Vanille.de> | 24 | 2003-11-30 Michael Lauer <mickey@Vanille.de> |
24 | 25 | ||
25 | * Released as Version 1.0.1 (Development Snapshot) | 26 | * Released as Version 1.0.1 (Development Snapshot) |
26 | * Fixed ARP decoding for wired networks. | 27 | * Fixed ARP decoding for wired networks. |
27 | Interestingly, 802.11 encapsulates these in IP packets, while wired ethernet just tags the type_of_protocol. | 28 | Interestingly, 802.11 encapsulates these in IP packets, while wired ethernet just tags the type_of_protocol. |
28 | * Added reading GPS data from a gps daemon. | 29 | * Added reading GPS data from a gps daemon. |
29 | * Started preparations for utilizing Wellenreiter II in wired networks. | 30 | * Started preparations for utilizing Wellenreiter II in wired networks. |
30 | * Implemented persistant configuration interface and retriggerable auto detection. | 31 | * Implemented persistant configuration interface and retriggerable auto detection. |
31 | * Added QCOP interface for talking to opie-networksettings. | 32 | * Added QCOP interface for talking to opie-networksettings. |
32 | * Added parsing of DHCP packets and detecting DHCP servers. | 33 | * Added parsing of DHCP packets and detecting DHCP servers. |
33 | * Overhauled the configuration window and started with the customizable event system. | 34 | * Overhauled the configuration window and started with the customizable event system. |
34 | * Added disabling the screensaver. | 35 | * Added disabling the screensaver. |
35 | * Added automatic opening and scrolling to the network tree if a new station appears. | 36 | * Added automatic opening and scrolling to the network tree if a new station appears. |
36 | 37 | ||
37 | 2003-05-10 Michael Lauer <mickey@Vanille.de> | 38 | 2003-05-10 Michael Lauer <mickey@Vanille.de> |
38 | 39 | ||
39 | * Released as Version 1.0 (Stable) | 40 | * Released as Version 1.0 (Stable) |
40 | * Added restarting the dhcp client if having killed it before. | 41 | * Added restarting the dhcp client if having killed it before. |
41 | * Decouple dump files from live capture to shift control over 'what' is dumped to applications. | 42 | * Decouple dump files from live capture to shift control over 'what' is dumped to applications. |
42 | 43 | ||
43 | 2003-05-05 Michael Lauer <mickey@Vanille.de> | 44 | 2003-05-05 Michael Lauer <mickey@Vanille.de> |
44 | 45 | ||
45 | * Released as Version 1.0-RC1 (Release Candidate) | 46 | * Released as Version 1.0-RC1 (Release Candidate) |
46 | * Fixed rare segfaults while sniffing and operating the GUI simultaenously. | 47 | * Fixed rare segfaults while sniffing and operating the GUI simultaenously. |
47 | * Parse more data packets and detect more participating stations. | 48 | * Parse more data packets and detect more participating stations. |
48 | * Added live graph window showing the signal strength on all channels. | 49 | * Added live graph window showing the signal strength on all channels. |
49 | * Added parsing ARP packets and identifying IP addresses of participating stations. | 50 | * Added parsing ARP packets and identifying IP addresses of participating stations. |
50 | * Added parsing with optionally enabled PRISM headers (signal strength). | 51 | * Added parsing with optionally enabled PRISM headers (signal strength). |
51 | 52 | ||
52 | 2003-04-12 Michael Lauer <mickey@Vanille.de> | 53 | 2003-04-12 Michael Lauer <mickey@Vanille.de> |
53 | 54 | ||
54 | * Released as Version 1.0 (Beta) | 55 | * Released as Version 1.0 (Beta) |
55 | * GUI enhancements in the Menubar and the Toolbar. | 56 | * GUI enhancements in the Menubar and the Toolbar. |
56 | * Improved keyboard handling. | 57 | * Improved keyboard handling. |
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 | |||
@@ -75,174 +75,174 @@ MScanListView::MScanListView( QWidget* parent, const char* name ) | |||
75 | addColumn( tr( "Last Seen" ) ); | 75 | addColumn( tr( "Last Seen" ) ); |
76 | setColumnAlignment( col_lastseen, AlignCenter ); | 76 | setColumnAlignment( col_lastseen, AlignCenter ); |
77 | addColumn( tr( "Location" ) ); | 77 | addColumn( tr( "Location" ) ); |
78 | setColumnAlignment( col_location, AlignCenter ); | 78 | setColumnAlignment( col_location, AlignCenter ); |
79 | setRootIsDecorated( true ); | 79 | setRootIsDecorated( true ); |
80 | setAllColumnsShowFocus( true ); | 80 | setAllColumnsShowFocus( true ); |
81 | 81 | ||
82 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 82 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
83 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 83 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
84 | 84 | ||
85 | #ifdef QWS | 85 | #ifdef QWS |
86 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 86 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | 91 | ||
92 | MScanListView::~MScanListView() | 92 | MScanListView::~MScanListView() |
93 | { | 93 | { |
94 | }; | 94 | }; |
95 | 95 | ||
96 | 96 | ||
97 | OListViewItem* MScanListView::childFactory() | 97 | OListViewItem* MScanListView::childFactory() |
98 | { | 98 | { |
99 | return new MScanListItem( this ); | 99 | return new MScanListItem( this ); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void MScanListView::serializeTo( QDataStream& s) const | 103 | void MScanListView::serializeTo( QDataStream& s) const |
104 | { | 104 | { |
105 | qDebug( "serializing MScanListView" ); | 105 | qDebug( "serializing MScanListView" ); |
106 | OListView::serializeTo( s ); | 106 | OListView::serializeTo( s ); |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void MScanListView::serializeFrom( QDataStream& s) | 110 | 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; |
136 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 137 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
137 | 138 | ||
138 | while ( item && ( item->text( col_essid ) != essid ) ) | 139 | while ( item && ( item->text( col_essid ) != essid ) ) |
139 | { | 140 | { |
140 | #ifdef DEBUG | 141 | #ifdef DEBUG |
141 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); | 142 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); |
142 | #endif | 143 | #endif |
143 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 144 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
144 | } | 145 | } |
145 | if ( item ) | 146 | if ( item ) |
146 | { | 147 | { |
147 | // we have already seen this net, check all childs if MAC exists | 148 | // we have already seen this net, check all childs if MAC exists |
148 | 149 | ||
149 | network = item; | 150 | network = item; |
150 | 151 | ||
151 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 152 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
152 | assert( item ); // this shouldn't fail | 153 | assert( item ); // this shouldn't fail |
153 | 154 | ||
154 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 155 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
155 | { | 156 | { |
156 | #ifdef DEBUG | 157 | #ifdef DEBUG |
157 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); | 158 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); |
158 | #endif | 159 | #endif |
159 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 160 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
160 | } | 161 | } |
161 | 162 | ||
162 | if ( item ) | 163 | if ( item ) |
163 | { | 164 | { |
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 |
213 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 213 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
214 | } | 214 | } |
215 | 215 | ||
216 | if ( subitem ) | 216 | if ( subitem ) |
217 | { | 217 | { |
218 | // we have already seen this item, it's a dupe | 218 | // we have already seen this item, it's a dupe |
219 | #ifdef DEBUG | 219 | #ifdef DEBUG |
220 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); | 220 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); |
221 | #endif | 221 | #endif |
222 | subitem->receivedBeacon(); //FIXME: sent data bit | 222 | subitem->receivedBeacon(); //FIXME: sent data bit |
223 | return; | 223 | return; |
224 | } | 224 | } |
225 | 225 | ||
226 | // Hey, it seems to be a new item :-D | 226 | // Hey, it seems to be a new item :-D |
227 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); | 227 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); |
228 | station->setManufacturer( addr.manufacturer() ); | 228 | station->setManufacturer( addr.manufacturer() ); |
229 | 229 | ||
230 | QString s; | 230 | QString s; |
231 | if ( type == "station" ) | 231 | if ( type == "station" ) |
232 | { | 232 | { |
233 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 233 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
234 | } | 234 | } |
235 | else | 235 | else |
236 | { | 236 | { |
237 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 237 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
238 | } | 238 | } |
239 | MLogWindow::logwindow()->log( s ); | 239 | MLogWindow::logwindow()->log( s ); |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 243 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) |
244 | { | 244 | { |
245 | QString s; | 245 | QString s; |
246 | MScanListItem* network; | 246 | MScanListItem* network; |
247 | 247 | ||
248 | QListViewItemIterator it( this ); | 248 | QListViewItemIterator it( this ); |
@@ -365,180 +365,186 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, | |||
365 | // we have already seen this item, it's a dupe | 365 | // we have already seen this item, it's a dupe |
366 | #ifdef DEBUG | 366 | #ifdef DEBUG |
367 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); | 367 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); |
368 | #endif | 368 | #endif |
369 | subitem->receivedBeacon(); //FIXME: sent data bit | 369 | subitem->receivedBeacon(); //FIXME: sent data bit |
370 | return; | 370 | return; |
371 | } | 371 | } |
372 | 372 | ||
373 | // never seen that - add new item | 373 | // never seen that - add new item |
374 | 374 | ||
375 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); | 375 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
376 | item->setText( col_essid, name ); | 376 | item->setText( col_essid, name ); |
377 | 377 | ||
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | } | 380 | } |
381 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 381 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
382 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 382 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
383 | (const char*) macaddr.toString(), (const char*) ip ) ); | 383 | (const char*) macaddr.toString(), (const char*) ip ) ); |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 387 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
388 | { | 388 | { |
389 | if ( !item ) return; | 389 | if ( !item ) return; |
390 | 390 | ||
391 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 391 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
392 | 392 | ||
393 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 393 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", |
394 | (const char*) itm->text(0), (const char*) itm->type, col ); | 394 | (const char*) itm->text(0), (const char*) itm->type, col ); |
395 | 395 | ||
396 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 396 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
397 | { | 397 | { |
398 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 398 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |
399 | 399 | ||
400 | QPopupMenu m( this ); | 400 | QPopupMenu m( this ); |
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 | { |
448 | return new MScanListItem( this ); | 448 | return new MScanListItem( this ); |
449 | } | 449 | } |
450 | 450 | ||
451 | void MScanListItem::serializeTo( QDataStream& s ) const | 451 | void MScanListItem::serializeTo( QDataStream& s ) const |
452 | { | 452 | { |
453 | #ifdef DEBUG | 453 | #ifdef DEBUG |
454 | qDebug( "serializing MScanListItem" ); | 454 | qDebug( "serializing MScanListItem" ); |
455 | #endif | 455 | #endif |
456 | OListViewItem::serializeTo( s ); | 456 | OListViewItem::serializeTo( s ); |
457 | 457 | ||
458 | s << _type; | 458 | s << _type; |
459 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 459 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
460 | } | 460 | } |
461 | 461 | ||
462 | void MScanListItem::serializeFrom( QDataStream& s ) | 462 | void MScanListItem::serializeFrom( QDataStream& s ) |
463 | { | 463 | { |
464 | #ifdef DEBUG | 464 | #ifdef DEBUG |
465 | qDebug( "serializing MScanListItem" ); | 465 | qDebug( "serializing MScanListItem" ); |
466 | #endif | 466 | #endif |
467 | OListViewItem::serializeFrom( s ); | 467 | OListViewItem::serializeFrom( s ); |
468 | 468 | ||
469 | char wep; | 469 | char wep; |
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() ); |
509 | //setText( col_lastseen, QTime::currentTime().toString() ); | 515 | //setText( col_lastseen, QTime::currentTime().toString() ); |
510 | 516 | ||
511 | listView()->triggerUpdate(); | 517 | listView()->triggerUpdate(); |
512 | 518 | ||
513 | this->type = type; | 519 | this->type = type; |
514 | _type = type; | 520 | _type = type; |
515 | _essid = essid; | 521 | _essid = essid; |
516 | _macaddr = macaddr; | 522 | _macaddr = macaddr; |
517 | _channel = channel; | 523 | _channel = channel; |
518 | _beacons = 1; | 524 | _beacons = 1; |
519 | _signal = 0; | 525 | _signal = 0; |
520 | 526 | ||
521 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) | 527 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) |
522 | { | 528 | { |
523 | listView()->ensureItemVisible( this ); | 529 | listView()->ensureItemVisible( this ); |
524 | } | 530 | } |
525 | 531 | ||
526 | } | 532 | } |
527 | 533 | ||
528 | 534 | ||
529 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 535 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
530 | { | 536 | { |
531 | setText( col_manuf, manufacturer ); | 537 | setText( col_manuf, manufacturer ); |
532 | } | 538 | } |
533 | 539 | ||
534 | 540 | ||
535 | void MScanListItem::setLocation( const QString& location ) | 541 | void MScanListItem::setLocation( const QString& location ) |
536 | { | 542 | { |
537 | setText( col_location, location ); | 543 | setText( col_location, location ); |
538 | } | 544 | } |
539 | 545 | ||
540 | 546 | ||
541 | void MScanListItem::receivedBeacon() | 547 | void MScanListItem::receivedBeacon() |
542 | { | 548 | { |
543 | _beacons++; | 549 | _beacons++; |
544 | #ifdef DEBUG | 550 | #ifdef DEBUG |
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 | |||
@@ -1,136 +1,137 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
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 SCANLIST_H | 16 | #ifndef SCANLIST_H |
17 | #define SCANLIST_H | 17 | #define SCANLIST_H |
18 | 18 | ||
19 | #include "gps.h" | 19 | #include "gps.h" |
20 | 20 | ||
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 | ||
28 | class QString; | 28 | class QString; |
29 | class MScanListItem; | 29 | class MScanListItem; |
30 | 30 | ||
31 | class MScanListView: public OListView | 31 | 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: |
57 | void rightButtonClicked(QListViewItem*,const QPoint&,int); | 57 | void rightButtonClicked(QListViewItem*,const QPoint&,int); |
58 | void joinNetwork( const QString&, const QString&, int, const QString& ); | 58 | void joinNetwork( const QString&, const QString&, int, const QString& ); |
59 | 59 | ||
60 | protected: | 60 | protected: |
61 | void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" ); | 61 | void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" ); |
62 | 62 | ||
63 | }; | 63 | }; |
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; }; |
101 | 102 | ||
102 | void setSignal( int signal ) { /* TODO */ }; | 103 | void setSignal( int signal ) { /* TODO */ }; |
103 | void receivedBeacon(); | 104 | void receivedBeacon(); |
104 | 105 | ||
105 | void setManufacturer( const QString& manufacturer ); | 106 | void setManufacturer( const QString& manufacturer ); |
106 | void setLocation( const QString& location ); | 107 | void setLocation( const QString& location ); |
107 | 108 | ||
108 | virtual OListViewItem* childFactory(); | 109 | virtual OListViewItem* childFactory(); |
109 | virtual void serializeTo( QDataStream& s ) const; | 110 | virtual void serializeTo( QDataStream& s ) const; |
110 | virtual void serializeFrom( QDataStream& s ); | 111 | virtual void serializeFrom( QDataStream& s ); |
111 | 112 | ||
112 | private: | 113 | private: |
113 | QString _type; | 114 | QString _type; |
114 | QString _essid; | 115 | QString _essid; |
115 | QString _macaddr; | 116 | QString _macaddr; |
116 | bool _wep; | 117 | bool _wep; |
117 | int _channel; | 118 | int _channel; |
118 | int _signal; | 119 | int _signal; |
119 | int _beacons; | 120 | int _beacons; |
120 | 121 | ||
121 | }; | 122 | }; |
122 | 123 | ||
123 | //****************************** MScanListViewFactory **************************************************************** | 124 | //****************************** MScanListViewFactory **************************************************************** |
124 | 125 | ||
125 | /* | 126 | /* |
126 | 127 | ||
127 | class MScanListViewFactory : public OListViewFactory | 128 | class MScanListViewFactory : public OListViewFactory |
128 | { | 129 | { |
129 | public: | 130 | public: |
130 | virtual QListView* listViewFactory(); | 131 | virtual QListView* listViewFactory(); |
131 | virtual QListViewItem* listViewItemFactory( QListView* lv ); | 132 | virtual QListViewItem* listViewItemFactory( QListView* lv ); |
132 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); | 133 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); |
133 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); | 134 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); |
134 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); | 135 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); |
135 | } | 136 | } |
136 | */ | 137 | */ |
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 | |||
@@ -116,152 +116,185 @@ void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | |||
116 | 116 | ||
117 | 117 | ||
118 | void Wellenreiter::channelHopped(int c) | 118 | void Wellenreiter::channelHopped(int c) |
119 | { | 119 | { |
120 | QString title = "Wellenreiter II -scan- ["; | 120 | QString title = "Wellenreiter II -scan- ["; |
121 | QString left; | 121 | QString left; |
122 | if ( c > 1 ) left.fill( '.', c-1 ); | 122 | if ( c > 1 ) left.fill( '.', c-1 ); |
123 | title.append( left ); | 123 | title.append( left ); |
124 | title.append( '|' ); | 124 | title.append( '|' ); |
125 | if ( c < iface->channels() ) | 125 | if ( c < iface->channels() ) |
126 | { | 126 | { |
127 | QString right; | 127 | QString right; |
128 | right.fill( '.', iface->channels()-c ); | 128 | right.fill( '.', iface->channels()-c ); |
129 | title.append( right ); | 129 | title.append( right ); |
130 | } | 130 | } |
131 | title.append( "]" ); | 131 | title.append( "]" ); |
132 | //title.append( QString().sprintf( " %02d", c ) ); | 132 | //title.append( QString().sprintf( " %02d", c ) ); |
133 | assert( parent() ); | 133 | assert( parent() ); |
134 | ( (QMainWindow*) parent() )->setCaption( title ); | 134 | ( (QMainWindow*) parent() )->setCaption( title ); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | void Wellenreiter::handleNotification( OPacket* p ) | 138 | void Wellenreiter::handleNotification( OPacket* p ) |
139 | { | 139 | { |
140 | QObjectList* l = p->queryList(); | 140 | QObjectList* l = p->queryList(); |
141 | QObjectListIt it( *l ); | 141 | QObjectListIt it( *l ); |
142 | QObject* o; | 142 | QObject* o; |
143 | 143 | ||
144 | while ( (o = it.current()) != 0 ) | 144 | while ( (o = it.current()) != 0 ) |
145 | { | 145 | { |
146 | QString name = it.current()->name(); | 146 | QString name = it.current()->name(); |
147 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 147 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
148 | { | 148 | { |
149 | QString action = configwindow->parsePackets->protocolAction( name ); | 149 | QString action = configwindow->parsePackets->protocolAction( name ); |
150 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 150 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); |
151 | doAction( action, name, p ); | 151 | doAction( action, name, 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!" ); |
180 | return; | 213 | return; |
181 | } | 214 | } |
182 | 215 | ||
183 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 216 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
184 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 217 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 218 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
186 | int channel = ds ? ds->channel() : -1; | 219 | int channel = ds ? ds->channel() : -1; |
187 | 220 | ||
188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 221 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
189 | 222 | ||
190 | GpsLocation loc( -111, -111 ); | 223 | GpsLocation loc( -111, -111 ); |
191 | if ( configwindow->enableGPS->isChecked() ) | 224 | if ( configwindow->enableGPS->isChecked() ) |
192 | { | 225 | { |
193 | // TODO: add check if GPS is working!? | 226 | // TODO: add check if GPS is working!? |
194 | qDebug( "Wellenreiter::gathering GPS data..." ); | 227 | qDebug( "Wellenreiter::gathering GPS data..." ); |
195 | loc = gps->position(); | 228 | loc = gps->position(); |
196 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 229 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
197 | } | 230 | } |
198 | 231 | ||
199 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 232 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
200 | 233 | ||
201 | // update graph window | 234 | // update graph window |
202 | if ( ds ) | 235 | if ( ds ) |
203 | { | 236 | { |
204 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 237 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
205 | if ( prism ) | 238 | if ( prism ) |
206 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 239 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
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() ) |
232 | { | 265 | { |
233 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 266 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
234 | from = wlan->macAddress3(); | 267 | from = wlan->macAddress3(); |
235 | to = wlan->macAddress2(); | 268 | to = wlan->macAddress2(); |
236 | } | 269 | } |
237 | else if ( !wlan->fromDS() && wlan->toDS() ) | 270 | else if ( !wlan->fromDS() && wlan->toDS() ) |
238 | { | 271 | { |
239 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 272 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
240 | from = wlan->macAddress2(); | 273 | from = wlan->macAddress2(); |
241 | to = wlan->macAddress3(); | 274 | to = wlan->macAddress3(); |
242 | } | 275 | } |
243 | else if ( wlan->fromDS() && wlan->toDS() ) | 276 | else if ( wlan->fromDS() && wlan->toDS() ) |
244 | { | 277 | { |
245 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 278 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
246 | from = wlan->macAddress4(); | 279 | from = wlan->macAddress4(); |
247 | to = wlan->macAddress3(); | 280 | to = wlan->macAddress3(); |
248 | } | 281 | } |
249 | else | 282 | else |
250 | { | 283 | { |
251 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 284 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
252 | from = wlan->macAddress2(); | 285 | from = wlan->macAddress2(); |
253 | to = wlan->macAddress1(); | 286 | to = wlan->macAddress1(); |
254 | } | 287 | } |
255 | } | 288 | } |
256 | 289 | ||
257 | 290 | ||
258 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | 291 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) |
259 | { | 292 | { |
260 | from = data->sourceAddress(); | 293 | from = data->sourceAddress(); |
261 | to = data->destinationAddress(); | 294 | to = data->destinationAddress(); |
262 | 295 | ||
263 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); | 296 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); |
264 | } | 297 | } |
265 | 298 | ||
266 | 299 | ||
267 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) | 300 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) |
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 | |||
@@ -30,77 +30,80 @@ class OWaveLanManagementPacket; | |||
30 | class OWaveLanControlPacket; | 30 | class OWaveLanControlPacket; |
31 | class OWaveLanDataPacket; | 31 | class OWaveLanDataPacket; |
32 | class OEthernetPacket; | 32 | class OEthernetPacket; |
33 | class OARPPacket; | 33 | class OARPPacket; |
34 | class OMacAddress; | 34 | class OMacAddress; |
35 | class OIPPacket; | 35 | class OIPPacket; |
36 | class OPacketCapturer; | 36 | class OPacketCapturer; |
37 | class OWirelessNetworkInterface; | 37 | class OWirelessNetworkInterface; |
38 | class WellenreiterConfigWindow; | 38 | class WellenreiterConfigWindow; |
39 | class MLogWindow; | 39 | class MLogWindow; |
40 | class MHexWindow; | 40 | class MHexWindow; |
41 | class GPS; | 41 | class GPS; |
42 | 42 | ||
43 | class Wellenreiter : public WellenreiterBase { | 43 | class Wellenreiter : public WellenreiterBase { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | Wellenreiter( QWidget* parent = 0 ); | 47 | Wellenreiter( QWidget* parent = 0 ); |
48 | ~Wellenreiter(); | 48 | ~Wellenreiter(); |
49 | 49 | ||
50 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 50 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
51 | MScanListView* netView() const { return netview; }; | 51 | MScanListView* netView() const { return netview; }; |
52 | MLogWindow* logWindow() const { return logwindow; }; | 52 | MLogWindow* logWindow() const { return logwindow; }; |
53 | MHexWindow* hexWindow() const { return hexwindow; }; | 53 | MHexWindow* hexWindow() const { return hexwindow; }; |
54 | bool isDaemonRunning() const { return sniffing; }; | 54 | bool isDaemonRunning() const { return sniffing; }; |
55 | QString captureFileName() const { return dumpname; }; | 55 | QString captureFileName() const { return dumpname; }; |
56 | 56 | ||
57 | public: | 57 | public: |
58 | bool sniffing; | 58 | bool sniffing; |
59 | 59 | ||
60 | protected: | 60 | protected: |
61 | virtual void timerEvent( QTimerEvent* ); | 61 | virtual void timerEvent( QTimerEvent* ); |
62 | 62 | ||
63 | public slots: | 63 | public slots: |
64 | void initialTimer(); | 64 | void initialTimer(); |
65 | 65 | ||
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 |
91 | OSystem _system; // Opie Operating System identifier | 94 | OSystem _system; // Opie Operating System identifier |
92 | #endif | 95 | #endif |
93 | 96 | ||
94 | QString dumpname; | 97 | QString dumpname; |
95 | OWirelessNetworkInterface* iface; | 98 | OWirelessNetworkInterface* iface; |
96 | OPacketCapturer* pcap; | 99 | OPacketCapturer* pcap; |
97 | WellenreiterConfigWindow* configwindow; | 100 | WellenreiterConfigWindow* configwindow; |
98 | GPS* gps; | 101 | GPS* gps; |
99 | 102 | ||
100 | //void readConfig(); | 103 | //void readConfig(); |
101 | //void writeConfig(); | 104 | //void writeConfig(); |
102 | }; | 105 | }; |
103 | 106 | ||
104 | 107 | ||
105 | 108 | ||
106 | #endif | 109 | #endif |