summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp85
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp88
3 files changed, 138 insertions, 36 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 34c69f5..1525934 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -1,310 +1,363 @@
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#include "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h" 17#include "configwindow.h"
18 18
19#include <assert.h> 19#include <assert.h>
20#include "manufacturers.h" 20#include "manufacturers.h"
21#include <qdatetime.h> 21#include <qdatetime.h>
22#include <qtextstream.h> 22#include <qtextstream.h>
23 23
24#ifdef QWS 24#ifdef QWS
25#include <opie/odevice.h> 25#include <opie/odevice.h>
26using namespace Opie; 26using namespace Opie;
27#endif 27#endif
28 28
29
30#ifdef QWS
31#include <qpe/resource.h>
32#else
33#include "resource.h"
34#endif
35
36const int col_type = 0;
37const int col_essid = 0;
38const int col_sig = 1;
39const int col_ap = 2;
40const int col_channel = 3;
41const int col_wep = 4;
42const int col_traffic = 5;
43const int col_manuf = 6;
44const int col_firstseen = 7;
45const int col_lastseen = 8;
46
29MScanListView::MScanListView( QWidget* parent, const char* name ) 47MScanListView::MScanListView( QWidget* parent, const char* name )
30 :OListView( parent, name ), _manufacturerdb( 0 ) 48 :OListView( parent, name ), _manufacturerdb( 0 )
31{ 49{
32 50
33 setFrameShape( QListView::StyledPanel ); 51 setFrameShape( QListView::StyledPanel );
34 setFrameShadow( QListView::Sunken ); 52 setFrameShadow( QListView::Sunken );
35 53
36 addColumn( tr( "Net/Station" ) ); 54 addColumn( tr( "Net/Station" ) );
37 setColumnAlignment( 0, AlignLeft || AlignVCenter ); 55 setColumnAlignment( 0, AlignLeft || AlignVCenter );
38 addColumn( tr( "B" ) ); 56 addColumn( tr( "B" ) );
39 setColumnAlignment( 1, AlignCenter ); 57 setColumnAlignment( 1, AlignCenter );
40 addColumn( tr( "AP" ) ); 58 addColumn( tr( "AP" ) );
41 setColumnAlignment( 2, AlignCenter ); 59 setColumnAlignment( 2, AlignCenter );
42 addColumn( tr( "Chn" ) ); 60 addColumn( tr( "Chn" ) );
43 setColumnAlignment( 3, AlignCenter ); 61 setColumnAlignment( 3, AlignCenter );
44 addColumn( tr( "W" ) ); 62 addColumn( tr( "W" ) );
45 setColumnAlignment( 4, AlignCenter ); 63 setColumnAlignment( 4, AlignCenter );
46 addColumn( tr( "T" ) ); 64 addColumn( tr( "T" ) );
47 setColumnAlignment( 5, AlignCenter ); 65 setColumnAlignment( 5, AlignCenter );
48 addColumn( tr( "Manufacturer" ) ); 66 addColumn( tr( "Manufacturer" ) );
49 setColumnAlignment( 6, AlignCenter ); 67 setColumnAlignment( 6, AlignCenter );
50 addColumn( tr( "First Seen" ) ); 68 addColumn( tr( "First Seen" ) );
51 setColumnAlignment( 7, AlignCenter ); 69 setColumnAlignment( 7, AlignCenter );
52 addColumn( tr( "Last Seen" ) ); 70 addColumn( tr( "Last Seen" ) );
53 setColumnAlignment( 8, AlignCenter ); 71 setColumnAlignment( 8, AlignCenter );
54 setRootIsDecorated( true ); 72 setRootIsDecorated( true );
55 setAllColumnsShowFocus( true ); 73 setAllColumnsShowFocus( true );
56}; 74};
57 75
58MScanListView::~MScanListView() 76MScanListView::~MScanListView()
59{ 77{
60}; 78};
61 79
62OListViewItem* MScanListView::childFactory() 80OListViewItem* MScanListView::childFactory()
63{ 81{
64 return new MScanListItem( this ); 82 return new MScanListItem( this );
65} 83}
66 84
67void MScanListView::serializeTo( QDataStream& s) const 85void MScanListView::serializeTo( QDataStream& s) const
68{ 86{
69 qDebug( "serializing MScanListView" ); 87 qDebug( "serializing MScanListView" );
70 OListView::serializeTo( s ); 88 OListView::serializeTo( s );
71} 89}
72 90
73void MScanListView::serializeFrom( QDataStream& s) 91void MScanListView::serializeFrom( QDataStream& s)
74{ 92{
75 qDebug( "serializing MScanListView" ); 93 qDebug( "serializing MScanListView" );
76 OListView::serializeFrom( s ); 94 OListView::serializeFrom( s );
77} 95}
78 96
79void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) 97void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb )
80{ 98{
81 _manufacturerdb = manufacturerdb; 99 _manufacturerdb = manufacturerdb;
82} 100}
83 101
84void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 102void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
85{ 103{
86 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) 104 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
87 105
88 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", 106 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]",
89 (const char*) type, 107 (const char*) type,
90 (const char*) essid, 108 (const char*) essid,
91 (const char*) macaddr, 109 (const char*) macaddr,
92 channel ); 110 channel );
93 111
94 // search, if we already have seen this net 112 // search, if we already have seen this net
95 113
96 QString s; 114 QString s;
97 MScanListItem* network; 115 MScanListItem* network;
98 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 116 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
99 117
100 while ( item && ( item->text( 0 ) != essid ) ) 118 while ( item && ( item->text( 0 ) != essid ) )
101 { 119 {
102 qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); 120 qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
103 item = static_cast<MScanListItem*> ( item->itemBelow() ); 121 item = static_cast<MScanListItem*> ( item->itemBelow() );
104 } 122 }
105 if ( item ) 123 if ( item )
106 { 124 {
107 // animate the item 125 // animate the item
108 126
109 /* 127 /*
110 128
111 const QPixmap* pixmap = item->pixmap( 0 ); 129 const QPixmap* pixmap = item->pixmap( 0 );
112 const QPixmap* nextpixmap = ani2; 130 const QPixmap* nextpixmap = ani2;
113 if ( pixmap == ani1 ) 131 if ( pixmap == ani1 )
114 nextpixmap = ani2; 132 nextpixmap = ani2;
115 else if ( pixmap == ani2 ) 133 else if ( pixmap == ani2 )
116 nextpixmap = ani3; 134 nextpixmap = ani3;
117 else if ( pixmap == ani3 ) 135 else if ( pixmap == ani3 )
118 nextpixmap = ani4; 136 nextpixmap = ani4;
119 else if ( pixmap == ani4 ) 137 else if ( pixmap == ani4 )
120 nextpixmap = ani1; 138 nextpixmap = ani1;
121 item->setPixmap( 0, *nextpixmap ); */ 139 item->setPixmap( 0, *nextpixmap ); */
122 140
123 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); 141 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap );
124 142
125 // we have already seen this net, check all childs if MAC exists 143 // we have already seen this net, check all childs if MAC exists
126 144
127 network = item; 145 network = item;
128 146
129 item = static_cast<MScanListItem*> ( item->firstChild() ); 147 item = static_cast<MScanListItem*> ( item->firstChild() );
130 assert( item ); // this shouldn't fail 148 assert( item ); // this shouldn't fail
131 149
132 while ( item && ( item->text( 2 ) != macaddr ) ) 150 while ( item && ( item->text( 2 ) != macaddr ) )
133 { 151 {
134 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); 152 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
135 item = static_cast<MScanListItem*> ( item->itemBelow() ); 153 item = static_cast<MScanListItem*> ( item->itemBelow() );
136 } 154 }
137 155
138 if ( item ) 156 if ( item )
139 { 157 {
140 // we have already seen this item, it's a dupe 158 // we have already seen this item, it's a dupe
141 #ifdef DEBUG 159 #ifdef DEBUG
142 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 160 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
143 #endif 161 #endif
144 item->receivedBeacon(); 162 item->receivedBeacon();
145 return; 163 return;
146 } 164 }
147 } 165 }
148 else 166 else
149 { 167 {
150 s.sprintf( "(i) new network: '%s'", (const char*) essid ); 168 s.sprintf( "(i) new network: '%s'", (const char*) essid );
151 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); 169 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
152 } 170 }
153 171
154 172
155 // insert new station as child from network 173 // insert new station as child from network
156 174
157 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 175 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
158 176
159 qDebug( "inserting new station %s", (const char*) macaddr ); 177 qDebug( "inserting new station %s", (const char*) macaddr );
160 178
161 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 179 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
162 if ( _manufacturerdb ) 180 if ( _manufacturerdb )
163 station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); 181 station->setManufacturer( _manufacturerdb->lookup( macaddr ) );
164 182
165 if ( type == "managed" ) 183 if ( type == "managed" )
166 { 184 {
167 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); 185 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
168 } 186 }
169 else 187 else
170 { 188 {
171 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); 189 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
172 } 190 }
173 191
174} 192}
175 193
176#ifdef QWS 194void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional )
177#include <qpe/resource.h> 195{
178#else 196 if ( type != "toDS" ) return;
179#include "resource.h"
180#endif
181 197
182const int col_type = 0; 198 qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)",
183const int col_essid = 0; 199 (const char*) type, (const char*) from,
184const int col_sig = 1; 200 (const char*) to, (const char*) via );
185const int col_ap = 2; 201
186const int col_channel = 3; 202 QString s;
187const int col_wep = 4; 203 MScanListItem* network;
188const int col_traffic = 5; 204
189const int col_manuf = 6; 205 QListViewItemIterator it( this );
190const int col_firstseen = 7; 206 while ( it.current() && it.current()->text( col_ap ) != via ) ++it;
191const int col_lastseen = 8; 207
208 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
209
210 if ( item ) // AP has been shown up, so just add our new "from" - station
211 {
212 network = static_cast<MScanListItem*>( item->parent() );
213 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
214
215 while ( subitem && ( subitem->text( col_ap ) != from ) )
216 {
217 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
218 subitem = static_cast<MScanListItem*> ( subitem->itemBelow() );
219 }
220
221 if ( subitem )
222 {
223 // we have already seen this item, it's a dupe
224 #ifdef DEBUG
225 qDebug( "%s is a dupe - ignoring...", (const char*) from );
226 #endif
227 subitem->receivedBeacon(); //FIXME: sent data bit
228 return;
229 }
230
231 // Hey, it seems to be a new item :-D
232 MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 );
233 if ( _manufacturerdb )
234 station->setManufacturer( _manufacturerdb->lookup( from ) );
235 }
236 else
237 {
238 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" );
239 }
240}
241
242//============================================================
243// MScanListItem
244//============================================================
192 245
193MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 246MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
194 bool wep, int channel, int signal ) 247 bool wep, int channel, int signal )
195 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 248 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
196 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 249 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
197 _channel( channel ), _signal( signal ), _beacons( 1 ) 250 _channel( channel ), _signal( signal ), _beacons( 1 )
198{ 251{
199 qDebug( "creating scanlist item" ); 252 qDebug( "creating scanlist item" );
200 if ( WellenreiterConfigWindow::instance() && type == "networks" ) 253 if ( WellenreiterConfigWindow::instance() && type == "networks" )
201 playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); 254 playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() );
202 decorateItem( type, essid, macaddr, wep, channel, signal ); 255 decorateItem( type, essid, macaddr, wep, channel, signal );
203} 256}
204 257
205MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, 258MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
206 bool wep, int channel, int signal ) 259 bool wep, int channel, int signal )
207 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 260 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
208{ 261{
209 qDebug( "creating scanlist item" ); 262 qDebug( "creating scanlist item" );
210 decorateItem( type, essid, macaddr, wep, channel, signal ); 263 decorateItem( type, essid, macaddr, wep, channel, signal );
211} 264}
212 265
213OListViewItem* MScanListItem::childFactory() 266OListViewItem* MScanListItem::childFactory()
214{ 267{
215 return new MScanListItem( this ); 268 return new MScanListItem( this );
216} 269}
217 270
218void MScanListItem::serializeTo( QDataStream& s ) const 271void MScanListItem::serializeTo( QDataStream& s ) const
219{ 272{
220 qDebug( "serializing MScanListItem" ); 273 qDebug( "serializing MScanListItem" );
221 OListViewItem::serializeTo( s ); 274 OListViewItem::serializeTo( s );
222 275
223 s << _type; 276 s << _type;
224 s << (Q_UINT8) _wep; 277 s << (Q_UINT8) _wep;
225} 278}
226 279
227void MScanListItem::serializeFrom( QDataStream& s ) 280void MScanListItem::serializeFrom( QDataStream& s )
228{ 281{
229 qDebug( "serializing MScanListItem" ); 282 qDebug( "serializing MScanListItem" );
230 OListViewItem::serializeFrom( s ); 283 OListViewItem::serializeFrom( s );
231 284
232 s >> _type; 285 s >> _type;
233 s >> (Q_UINT8) _wep; 286 s >> (Q_UINT8) _wep;
234 287
235 QString name; 288 QString name;
236 name.sprintf( "wellenreiter/%s", (const char*) _type ); 289 name.sprintf( "wellenreiter/%s", (const char*) _type );
237 setPixmap( col_type, Resource::loadPixmap( name ) ); 290 setPixmap( col_type, Resource::loadPixmap( name ) );
238 if ( _wep ) 291 if ( _wep )
239 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 292 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
240 listView()->triggerUpdate(); 293 listView()->triggerUpdate();
241} 294}
242 295
243void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 296void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
244{ 297{
245 qDebug( "decorating scanlist item %s / %s / %s [%d]", 298 qDebug( "decorating scanlist item %s / %s / %s [%d]",
246 (const char*) type, 299 (const char*) type,
247 (const char*) essid, 300 (const char*) essid,
248 (const char*) macaddr, 301 (const char*) macaddr,
249 channel ); 302 channel );
250 303
251 // set icon for managed or adhoc mode 304 // set icon for managed or adhoc mode
252 QString name; 305 QString name;
253 name.sprintf( "wellenreiter/%s", (const char*) type ); 306 name.sprintf( "wellenreiter/%s", (const char*) type );
254 setPixmap( col_type, Resource::loadPixmap( name ) ); 307 setPixmap( col_type, Resource::loadPixmap( name ) );
255 308
256 // set icon for wep (wireless encryption protocol) 309 // set icon for wep (wireless encryption protocol)
257 if ( wep ) 310 if ( wep )
258 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 311 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
259 312
260 // set channel and signal text 313 // set channel and signal text
261 314
262 if ( signal != -1 ) 315 if ( signal != -1 )
263 setText( col_sig, QString::number( signal ) ); 316 setText( col_sig, QString::number( signal ) );
264 if ( channel != -1 ) 317 if ( channel != -1 )
265 setText( col_channel, QString::number( channel ) ); 318 setText( col_channel, QString::number( channel ) );
266 319
267 setText( col_firstseen, QTime::currentTime().toString() ); 320 setText( col_firstseen, QTime::currentTime().toString() );
268 //setText( col_lastseen, QTime::currentTime().toString() ); 321 //setText( col_lastseen, QTime::currentTime().toString() );
269 322
270 listView()->triggerUpdate(); 323 listView()->triggerUpdate();
271 324
272 this->type = type; 325 this->type = type;
273 _type = type; 326 _type = type;
274 _essid = essid; 327 _essid = essid;
275 _macaddr = macaddr; 328 _macaddr = macaddr;
276 _channel = channel; 329 _channel = channel;
277 _beacons = 1; 330 _beacons = 1;
278 _signal = 0; 331 _signal = 0;
279} 332}
280 333
281 334
282void MScanListItem::setManufacturer( const QString& manufacturer ) 335void MScanListItem::setManufacturer( const QString& manufacturer )
283{ 336{
284 setText( col_manuf, manufacturer ); 337 setText( col_manuf, manufacturer );
285} 338}
286 339
287 340
288void MScanListItem::playSound( const QString& sound ) const 341void MScanListItem::playSound( const QString& sound ) const
289{ 342{
290 #ifdef QWS 343 #ifdef QWS
291 if ( sound == "Ignore" ) return; 344 if ( sound == "Ignore" ) return;
292 else if ( sound == "Touch" ) ODevice::inst()->touchSound(); 345 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
293 else if ( sound == "Key" ) ODevice::inst()->keySound(); 346 else if ( sound == "Key" ) ODevice::inst()->keySound();
294 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); 347 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
295 #endif 348 #endif
296} 349}
297 350
298 351
299void MScanListItem::receivedBeacon() 352void MScanListItem::receivedBeacon()
300{ 353{
301 _beacons++; 354 _beacons++;
302 #ifdef DEBUG 355 #ifdef DEBUG
303 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 356 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
304 #endif 357 #endif
305 setText( col_sig, QString::number( _beacons ) ); 358 setText( col_sig, QString::number( _beacons ) );
306 setText( col_lastseen, QTime::currentTime().toString() ); 359 setText( col_lastseen, QTime::currentTime().toString() );
307 if ( WellenreiterConfigWindow::instance() ) 360 if ( WellenreiterConfigWindow::instance() )
308 playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); 361 playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() );
309} 362}
310 363
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 01db172..bed69f1 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -1,124 +1,125 @@
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 <opie2/olistview.h> 19#include <opie2/olistview.h>
20 20
21#include <qtextstream.h> 21#include <qtextstream.h>
22 22
23class QString; 23class QString;
24class ManufacturerDB; 24class ManufacturerDB;
25 25
26class MScanListView: public OListView 26class MScanListView: public OListView
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 MScanListView( QWidget* parent = 0, const char* name = 0 ); 31 MScanListView( QWidget* parent = 0, const char* name = 0 );
32 virtual ~MScanListView(); 32 virtual ~MScanListView();
33 33
34 void setManufacturerDB( ManufacturerDB* manufacturerdb ); 34 void setManufacturerDB( ManufacturerDB* manufacturerdb );
35 35
36 virtual OListViewItem* childFactory(); 36 virtual OListViewItem* childFactory();
37 virtual void serializeTo( QDataStream& s ) const; 37 virtual void serializeTo( QDataStream& s ) const;
38 virtual void serializeFrom( QDataStream& s ); 38 virtual void serializeFrom( QDataStream& s );
39 39
40 public slots: 40 public slots:
41 void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 41 void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
42 void traffic( QString type, QString from, QString to, QString via, QString additional = QString::null );
42 43
43 private: 44 private:
44 ManufacturerDB* _manufacturerdb; 45 ManufacturerDB* _manufacturerdb;
45 46
46}; 47};
47 48
48//****************************** MScanListItem **************************************************************** 49//****************************** MScanListItem ****************************************************************
49 50
50class MScanListItem: public OListViewItem 51class MScanListItem: public OListViewItem
51{ 52{
52 public: 53 public:
53 MScanListItem::MScanListItem( QListView* parent, 54 MScanListItem::MScanListItem( QListView* parent,
54 QString type = "unknown", 55 QString type = "unknown",
55 QString essid = "unknown", 56 QString essid = "unknown",
56 QString macaddr = "unknown", 57 QString macaddr = "unknown",
57 bool wep = false, 58 bool wep = false,
58 int channel = 0, 59 int channel = 0,
59 int signal = 0 ); 60 int signal = 0 );
60 61
61 MScanListItem::MScanListItem( QListViewItem* parent, 62 MScanListItem::MScanListItem( QListViewItem* parent,
62 QString type = "unknown", 63 QString type = "unknown",
63 QString essid = "unknown", 64 QString essid = "unknown",
64 QString macaddr = "unknown", 65 QString macaddr = "unknown",
65 bool wep = false, 66 bool wep = false,
66 int channel = 0, 67 int channel = 0,
67 int signal = 0 ); 68 int signal = 0 );
68 69
69 70
70 protected: 71 protected:
71 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 72 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
72 73
73 public: 74 public:
74 QString type; 75 QString type;
75 76
76 public: 77 public:
77 //const QString& type() { return _type; }; 78 //const QString& type() { return _type; };
78 const QString& essid() { return _essid; }; 79 const QString& essid() { return _essid; };
79 const QString& macaddr() { return _macaddr; }; 80 const QString& macaddr() { return _macaddr; };
80 bool wep() { return _wep; }; 81 bool wep() { return _wep; };
81 int channel() { return _channel; }; 82 int channel() { return _channel; };
82 int signal() { return _signal; }; 83 int signal() { return _signal; };
83 int beacons() { return _beacons; }; 84 int beacons() { return _beacons; };
84 85
85 void setSignal( int signal ) { /* TODO */ }; 86 void setSignal( int signal ) { /* TODO */ };
86 void receivedBeacon(); 87 void receivedBeacon();
87 88
88 void setManufacturer( const QString& manufacturer ); 89 void setManufacturer( const QString& manufacturer );
89 90
90 virtual OListViewItem* childFactory(); 91 virtual OListViewItem* childFactory();
91 virtual void serializeTo( QDataStream& s ) const; 92 virtual void serializeTo( QDataStream& s ) const;
92 virtual void serializeFrom( QDataStream& s ); 93 virtual void serializeFrom( QDataStream& s );
93 94
94 protected: 95 protected:
95 void playSound( const QString& ) const; 96 void playSound( const QString& ) const;
96 97
97 private: 98 private:
98 QString _type; 99 QString _type;
99 QString _essid; 100 QString _essid;
100 QString _macaddr; 101 QString _macaddr;
101 bool _wep; 102 bool _wep;
102 int _channel; 103 int _channel;
103 int _signal; 104 int _signal;
104 int _beacons; 105 int _beacons;
105 106
106}; 107};
107 108
108//****************************** MScanListViewFactory **************************************************************** 109//****************************** MScanListViewFactory ****************************************************************
109 110
110/* 111/*
111 112
112class MScanListViewFactory : public OListViewFactory 113class MScanListViewFactory : public OListViewFactory
113{ 114{
114public: 115public:
115 virtual QListView* listViewFactory(); 116 virtual QListView* listViewFactory();
116 virtual QListViewItem* listViewItemFactory( QListView* lv ); 117 virtual QListViewItem* listViewItemFactory( QListView* lv );
117 virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); 118 virtual QListViewItem* listViewItemFactory( QListViewItem* lvi );
118 virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); 119 virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text );
119 virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); 120 virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text );
120} 121}
121*/ 122*/
122 123
123#endif 124#endif
124 125
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index aa33158..8d18f73 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,237 +1,285 @@
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// Opie 16// Opie
17 17
18#ifdef QWS 18#ifdef QWS
19#include <opie/odevice.h> 19#include <opie/odevice.h>
20using namespace Opie; 20using namespace Opie;
21#endif 21#endif
22 22
23#ifdef QWS 23#ifdef QWS
24#include <opie2/oapplication.h> 24#include <opie2/oapplication.h>
25#else 25#else
26#include <qapplication.h> 26#include <qapplication.h>
27#endif 27#endif
28#include <opie2/onetwork.h> 28#include <opie2/onetwork.h>
29#include <opie2/opcap.h> 29#include <opie2/opcap.h>
30 30
31// Qt 31// Qt
32 32
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qmessagebox.h> 34#include <qmessagebox.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qsocketnotifier.h> 37#include <qsocketnotifier.h>
38 38
39// Standard 39// Standard
40 40
41#include <assert.h> 41#include <assert.h>
42#include <errno.h> 42#include <errno.h>
43#include <unistd.h> 43#include <unistd.h>
44#include <string.h> 44#include <string.h>
45#include <sys/types.h> 45#include <sys/types.h>
46#include <stdlib.h> 46#include <stdlib.h>
47 47
48// Local 48// Local
49 49
50#include "wellenreiter.h" 50#include "wellenreiter.h"
51#include "scanlist.h" 51#include "scanlist.h"
52#include "logwindow.h" 52#include "logwindow.h"
53#include "hexwindow.h" 53#include "hexwindow.h"
54#include "configwindow.h" 54#include "configwindow.h"
55 55
56#include "manufacturers.h" 56#include "manufacturers.h"
57 57
58Wellenreiter::Wellenreiter( QWidget* parent ) 58Wellenreiter::Wellenreiter( QWidget* parent )
59 : WellenreiterBase( parent, 0, 0 ), 59 : WellenreiterBase( parent, 0, 0 ),
60 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) 60 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
61{ 61{
62 62
63 // 63 //
64 // construct manufacturer database 64 // construct manufacturer database
65 // 65 //
66 66
67 QString manufile; 67 QString manufile;
68 #ifdef QWS 68 #ifdef QWS
69 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); 69 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
70 #else 70 #else
71 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); 71 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" );
72 #endif 72 #endif
73 manufacturerdb = new ManufacturerDB( manufile ); 73 manufacturerdb = new ManufacturerDB( manufile );
74 74
75 logwindow->log( "(i) Wellenreiter has been started." ); 75 logwindow->log( "(i) Wellenreiter has been started." );
76 76
77 // 77 //
78 // detect operating system 78 // detect operating system
79 // 79 //
80 80
81 #ifdef QWS 81 #ifdef QWS
82 QString sys; 82 QString sys;
83 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); 83 sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
84 _system = ODevice::inst()->system(); 84 _system = ODevice::inst()->system();
85 logwindow->log( sys ); 85 logwindow->log( sys );
86 #endif 86 #endif
87 87
88 // setup GUI 88 // setup GUI
89 netview->setColumnWidthMode( 1, QListView::Manual ); 89 netview->setColumnWidthMode( 1, QListView::Manual );
90 90
91 if ( manufacturerdb ) 91 if ( manufacturerdb )
92 netview->setManufacturerDB( manufacturerdb ); 92 netview->setManufacturerDB( manufacturerdb );
93 93
94 pcap = new OPacketCapturer(); 94 pcap = new OPacketCapturer();
95 95
96} 96}
97 97
98Wellenreiter::~Wellenreiter() 98Wellenreiter::~Wellenreiter()
99{ 99{
100 // no need to delete child widgets, Qt does it all for us 100 // no need to delete child widgets, Qt does it all for us
101 101
102 delete manufacturerdb; 102 delete manufacturerdb;
103 delete pcap; 103 delete pcap;
104} 104}
105 105
106void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 106void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
107{ 107{
108 configwindow = cw; 108 configwindow = cw;
109} 109}
110 110
111void Wellenreiter::receivePacket(OPacket* p) 111void Wellenreiter::receivePacket(OPacket* p)
112{ 112{
113 hexWindow()->log( p->dump( 8 ) ); 113 hexWindow()->log( p->dump( 8 ) );
114 114
115 // check if we received a beacon frame 115 // check if we received a beacon frame
116 // static_cast is justified here
117 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 116 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
118 if ( !beacon ) return; 117 if ( beacon )
119 QString type; 118 {
120 119 QString type;
121 //FIXME: Can stations in ESS mode can be distinguished from APs? 120 if ( beacon->canIBSS() )
122 //FIXME: Apparently yes, but not by listening to beacons, because 121 type = "adhoc";
123 //FIXME: they simply don't send beacons in infrastructure mode. 122 else
124 //FIXME: so we also have to listen to data packets 123 type = "managed";
125 124
126 if ( beacon->canIBSS() ) 125 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
127 type = "adhoc"; 126 QString essid = ssid ? ssid->ID() : QString("<unknown>");
128 else 127 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
129 type = "managed"; 128 int channel = ds ? ds->channel() : -1;
130 129
131 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 130 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
132 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 131 netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 );
133 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 132 return;
134 int channel = ds ? ds->channel() : -1; 133 }
135 134
136 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 135 // check for a data frame
137 netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 ); 136 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) );
137 if ( data )
138 {
139 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
140 if ( wlan->fromDS() && !wlan->toDS() )
141 {
142 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'",
143 (const char*) wlan->macAddress3().toString(true),
144 (const char*) wlan->macAddress1().toString(true),
145 (const char*) wlan->macAddress2().toString(true) );
146 netView()->traffic( "fromDS", wlan->macAddress3().toString(),
147 wlan->macAddress1().toString(),
148 wlan->macAddress2().toString() );
149 }
150 else
151 if ( !wlan->fromDS() && wlan->toDS() )
152 {
153 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'",
154 (const char*) wlan->macAddress2().toString(true),
155 (const char*) wlan->macAddress3().toString(true),
156 (const char*) wlan->macAddress1().toString(true) );
157 netView()->traffic( "toDS", wlan->macAddress2().toString(),
158 wlan->macAddress3().toString(),
159 wlan->macAddress1().toString() );
160 }
161 else
162 if ( wlan->fromDS() && wlan->toDS() )
163 {
164 qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'",
165 (const char*) wlan->macAddress4().toString(true),
166 (const char*) wlan->macAddress3().toString(true),
167 (const char*) wlan->macAddress1().toString(true),
168 (const char*) wlan->macAddress2().toString(true) );
169 netView()->traffic( "WSD", wlan->macAddress4().toString(),
170 wlan->macAddress3().toString(),
171 wlan->macAddress1().toString(),
172 wlan->macAddress2().toString() );
173 }
174 else
175 {
176 qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'",
177 (const char*) wlan->macAddress2().toString(true),
178 (const char*) wlan->macAddress1().toString(true),
179 (const char*) wlan->macAddress3().toString(true) );
180 netView()->traffic( "fromDS", wlan->macAddress2().toString(),
181 wlan->macAddress1().toString(),
182 wlan->macAddress3().toString() );
183 }
184 return;
185 }
138} 186}
139 187
140void Wellenreiter::startStopClicked() 188void Wellenreiter::startStopClicked()
141{ 189{
142 if ( sniffing ) 190 if ( sniffing )
143 { 191 {
144 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 192 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
145 193
146 iface->setChannelHopping(); // stop hopping channels 194 iface->setChannelHopping(); // stop hopping channels
147 pcap->close(); 195 pcap->close();
148 sniffing = false; 196 sniffing = false;
149 #ifdef QWS 197 #ifdef QWS
150 oApp->setTitle(); 198 oApp->setTitle();
151 #else 199 #else
152 qApp->mainWidget()->setCaption( "Wellenreiter II" ); 200 qApp->mainWidget()->setCaption( "Wellenreiter II" );
153 #endif 201 #endif
154 202
155 // get interface name from config window 203 // get interface name from config window
156 const QString& interface = configwindow->interfaceName->currentText(); 204 const QString& interface = configwindow->interfaceName->currentText();
157 ONetwork* net = ONetwork::instance(); 205 ONetwork* net = ONetwork::instance();
158 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 206 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
159 207
160 // switch off monitor mode 208 // switch off monitor mode
161 iface->setMonitorMode( false ); 209 iface->setMonitorMode( false );
162 // switch off promisc flag 210 // switch off promisc flag
163 iface->setPromiscuousMode( false ); 211 iface->setPromiscuousMode( false );
164 212
165 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess 213 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
166 logwindow->log( "(i) Stopped Scanning." ); 214 logwindow->log( "(i) Stopped Scanning." );
167 215
168 // message the user 216 // message the user
169 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); 217 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
170 } 218 }
171 219
172 else 220 else
173 { 221 {
174 // get configuration from config window 222 // get configuration from config window
175 223
176 const QString& interface = configwindow->interfaceName->currentText(); 224 const QString& interface = configwindow->interfaceName->currentText();
177 const int cardtype = configwindow->daemonDeviceType(); 225 const int cardtype = configwindow->daemonDeviceType();
178 const int interval = configwindow->daemonHopInterval(); 226 const int interval = configwindow->daemonHopInterval();
179 227
180 if ( ( interface == "" ) || ( cardtype == 0 ) ) 228 if ( ( interface == "" ) || ( cardtype == 0 ) )
181 { 229 {
182 QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); 230 QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" );
183 return; 231 return;
184 } 232 }
185 233
186 // configure device 234 // configure device
187 235
188 ONetwork* net = ONetwork::instance(); 236 ONetwork* net = ONetwork::instance();
189 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 237 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
190 238
191 // set monitor mode 239 // set monitor mode
192 240
193 switch ( cardtype ) 241 switch ( cardtype )
194 { 242 {
195 case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; 243 case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
196 case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; 244 case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
197 case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; 245 case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
198 case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; 246 case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
199 default: assert( 0 ); // shouldn't happen 247 default: assert( 0 ); // shouldn't happen
200 } 248 }
201 249
202 iface->setMonitorMode( true ); 250 iface->setMonitorMode( true );
203 251
204 if ( !iface->monitorMode() ) 252 if ( !iface->monitorMode() )
205 { 253 {
206 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); 254 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
207 return; 255 return;
208 } 256 }
209 257
210 // open pcap and start sniffing 258 // open pcap and start sniffing
211 pcap->open( interface ); 259 pcap->open( interface );
212 260
213 if ( !pcap->isOpen() ) 261 if ( !pcap->isOpen() )
214 { 262 {
215 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); 263 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
216 return; 264 return;
217 } 265 }
218 266
219 // set capturer to non-blocking mode 267 // set capturer to non-blocking mode
220 pcap->setBlocking( false ); 268 pcap->setBlocking( false );
221 269
222 // start channel hopper 270 // start channel hopper
223 iface->setChannelHopping( 1000 ); //use interval from config window 271 iface->setChannelHopping( 1000 ); //use interval from config window
224 272
225 // connect 273 // connect
226 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 274 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
227 275
228 logwindow->log( "(i) Started Scanning." ); 276 logwindow->log( "(i) Started Scanning." );
229 #ifdef QWS 277 #ifdef QWS
230 oApp->setTitle( "Scanning ..." ); 278 oApp->setTitle( "Scanning ..." );
231 #else 279 #else
232 qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); 280 qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." );
233 #endif 281 #endif
234 sniffing = true; 282 sniffing = true;
235 283
236 } 284 }
237} 285}