Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 45d7142..25632f3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -136,176 +136,176 @@ void Wellenreiter::channelHopped(int c) | |||
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" ) return; // only handling beacons at that time |
165 | 165 | ||
166 | OWaveLanManagementPacket* beacon = manage; | 166 | OWaveLanManagementPacket* beacon = manage; |
167 | 167 | ||
168 | QString type; | 168 | QString type; |
169 | if ( beacon->canIBSS() ) | 169 | if ( beacon->canIBSS() ) |
170 | { | 170 | { |
171 | type = "adhoc"; | 171 | type = "adhoc"; |
172 | } | 172 | } |
173 | else if ( beacon->canESS() ) | 173 | else if ( beacon->canESS() ) |
174 | { | 174 | { |
175 | type = "managed"; | 175 | type = "managed"; |
176 | } | 176 | } |
177 | else | 177 | else |
178 | { | 178 | { |
179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 179 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | 182 | ||
183 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 183 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
184 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 184 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 185 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
186 | int channel = ds ? ds->channel() : -1; | 186 | int channel = ds ? ds->channel() : -1; |
187 | 187 | ||
188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 188 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
189 | 189 | ||
190 | GpsLocation loc( -111.111, -111.111 ); | 190 | GpsLocation loc( -111, -111 ); |
191 | if ( configwindow->enableGPS->isChecked() ) | 191 | if ( configwindow->enableGPS->isChecked() ) |
192 | { | 192 | { |
193 | // TODO: add check if GPS is working!? | 193 | // TODO: add check if GPS is working!? |
194 | qDebug( "Wellenreiter::gathering GPS data..." ); | 194 | qDebug( "Wellenreiter::gathering GPS data..." ); |
195 | loc = gps->position(); | 195 | loc = gps->position(); |
196 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 196 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
197 | } | 197 | } |
198 | 198 | ||
199 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 199 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
200 | 200 | ||
201 | // update graph window | 201 | // update graph window |
202 | if ( ds ) | 202 | if ( ds ) |
203 | { | 203 | { |
204 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 204 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
205 | if ( prism ) | 205 | if ( prism ) |
206 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 206 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
207 | else | 207 | else |
208 | graphwindow->traffic( ds->channel(), 95 ); | 208 | graphwindow->traffic( ds->channel(), 95 ); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | 213 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) |
214 | { | 214 | { |
215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
216 | 216 | ||
217 | if ( control->controlType() == "Acknowledge" ) | 217 | if ( control->controlType() == "Acknowledge" ) |
218 | { | 218 | { |
219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) ); | 219 | netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); |
220 | } | 220 | } |
221 | else | 221 | else |
222 | { | 222 | { |
223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | 223 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 228 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
229 | { | 229 | { |
230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 230 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
231 | if ( wlan->fromDS() && !wlan->toDS() ) | 231 | if ( wlan->fromDS() && !wlan->toDS() ) |
232 | { | 232 | { |
233 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 233 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
234 | from = wlan->macAddress3(); | 234 | from = wlan->macAddress3(); |
235 | to = wlan->macAddress2(); | 235 | to = wlan->macAddress2(); |
236 | } | 236 | } |
237 | else if ( !wlan->fromDS() && wlan->toDS() ) | 237 | else if ( !wlan->fromDS() && wlan->toDS() ) |
238 | { | 238 | { |
239 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 239 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
240 | from = wlan->macAddress2(); | 240 | from = wlan->macAddress2(); |
241 | to = wlan->macAddress3(); | 241 | to = wlan->macAddress3(); |
242 | } | 242 | } |
243 | else if ( wlan->fromDS() && wlan->toDS() ) | 243 | else if ( wlan->fromDS() && wlan->toDS() ) |
244 | { | 244 | { |
245 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 245 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
246 | from = wlan->macAddress4(); | 246 | from = wlan->macAddress4(); |
247 | to = wlan->macAddress3(); | 247 | to = wlan->macAddress3(); |
248 | } | 248 | } |
249 | else | 249 | else |
250 | { | 250 | { |
251 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 251 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
252 | from = wlan->macAddress2(); | 252 | from = wlan->macAddress2(); |
253 | to = wlan->macAddress1(); | 253 | to = wlan->macAddress1(); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | 257 | ||
258 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) | 258 | void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) |
259 | { | 259 | { |
260 | from = data->sourceAddress(); | 260 | from = data->sourceAddress(); |
261 | to = data->destinationAddress(); | 261 | to = data->destinationAddress(); |
262 | 262 | ||
263 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) ); | 263 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) | 267 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) |
268 | { | 268 | { |
269 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 269 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
270 | if ( arp ) | 270 | if ( arp ) |
271 | { | 271 | { |
272 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 272 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
273 | if ( arp->type() == "REQUEST" ) | 273 | if ( arp->type() == "REQUEST" ) |
274 | { | 274 | { |
275 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 275 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
276 | } | 276 | } |
277 | else if ( arp->type() == "REPLY" ) | 277 | else if ( arp->type() == "REPLY" ) |
278 | { | 278 | { |
279 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 279 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
280 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 280 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) | 286 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) |
287 | { | 287 | { |
288 | //TODO: Implement more IP based protocols | 288 | //TODO: Implement more IP based protocols |
289 | 289 | ||
290 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); | 290 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); |
291 | if ( dhcp ) | 291 | if ( dhcp ) |
292 | { | 292 | { |
293 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); | 293 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); |
294 | if ( dhcp->type() == "OFFER" ) | 294 | if ( dhcp->type() == "OFFER" ) |
295 | { | 295 | { |
296 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); | 296 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); |
297 | netView()->identify( source, dhcp->serverAddress().toString() ); | 297 | netView()->identify( source, dhcp->serverAddress().toString() ); |
298 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 298 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
299 | } | 299 | } |
300 | else if ( dhcp->type() == "ACK" ) | 300 | else if ( dhcp->type() == "ACK" ) |
301 | { | 301 | { |
302 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); | 302 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); |
303 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | 303 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 309 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
310 | { | 310 | { |
311 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 311 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |