summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp39
1 files changed, 36 insertions, 3 deletions
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
@@ -140,52 +140,85 @@ void Wellenreiter::handleNotification( OPacket* p )
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
162void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) 162void 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
171void 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
194void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response )
195{
196}
197
198
199void 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() )
@@ -195,49 +228,49 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket*
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
213void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) 246void 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
228void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) 261void 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() )