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, 5 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index c03debb..5dc2e79 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -126,104 +126,106 @@ void Wellenreiter::channelHopped(int c) | |||
126 | void Wellenreiter::handleNotification( OPacket* p ) | 126 | void Wellenreiter::handleNotification( OPacket* p ) |
127 | { | 127 | { |
128 | QObjectList* l = p->queryList(); | 128 | QObjectList* l = p->queryList(); |
129 | QObjectListIt it( *l ); | 129 | QObjectListIt it( *l ); |
130 | QObject* o; | 130 | QObject* o; |
131 | 131 | ||
132 | while ( (o = it.current()) != 0 ) | 132 | while ( (o = it.current()) != 0 ) |
133 | { | 133 | { |
134 | QString name = it.current()->name(); | 134 | QString name = it.current()->name(); |
135 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 135 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
136 | { | 136 | { |
137 | QString action = configwindow->parsePackets->protocolAction( name ); | 137 | QString action = configwindow->parsePackets->protocolAction( name ); |
138 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 138 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); |
139 | doAction( action, name, p ); | 139 | doAction( action, name, p ); |
140 | } | 140 | } |
141 | else | 141 | else |
142 | { | 142 | { |
143 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 143 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); |
144 | } | 144 | } |
145 | ++it; | 145 | ++it; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 150 | void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
151 | { | 151 | { |
152 | QString type; | 152 | QString type; |
153 | if ( beacon->canIBSS() ) | 153 | if ( beacon->canIBSS() ) |
154 | { | 154 | { |
155 | type = "adhoc"; | 155 | type = "adhoc"; |
156 | } | 156 | } |
157 | else if ( beacon->canESS() ) | 157 | else if ( beacon->canESS() ) |
158 | { | 158 | { |
159 | type = "managed"; | 159 | type = "managed"; |
160 | } | 160 | } |
161 | else | 161 | else |
162 | { | 162 | { |
163 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 163 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | 166 | ||
167 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 167 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
168 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 168 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
169 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 169 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
170 | int channel = ds ? ds->channel() : -1; | 170 | int channel = ds ? ds->channel() : -1; |
171 | 171 | ||
172 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 172 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
173 | 173 | ||
174 | GpsLocation loc( 0, 0 ); | ||
174 | if ( configwindow->enableGPS->isChecked() ) | 175 | if ( configwindow->enableGPS->isChecked() ) |
175 | { | 176 | { |
177 | // TODO: add check if GPS is working!? | ||
176 | qDebug( "Wellenreiter::gathering GPS data..." ); | 178 | qDebug( "Wellenreiter::gathering GPS data..." ); |
177 | float lat = gps->latitude(); | 179 | loc = gps->position(); |
178 | qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 ); | 180 | qDebug( "Wellenreiter::GPS data received is ( %f , %f )", loc.latitude, loc.longitude ); |
179 | } | 181 | } |
180 | 182 | ||
181 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); | 183 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
182 | 184 | ||
183 | // update graph window | 185 | // update graph window |
184 | if ( ds ) | 186 | if ( ds ) |
185 | { | 187 | { |
186 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 188 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
187 | if ( prism ) | 189 | if ( prism ) |
188 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 190 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
189 | else | 191 | else |
190 | graphwindow->traffic( ds->channel(), 95 ); | 192 | graphwindow->traffic( ds->channel(), 95 ); |
191 | } | 193 | } |
192 | } | 194 | } |
193 | 195 | ||
194 | 196 | ||
195 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) | 197 | void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) |
196 | { | 198 | { |
197 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 199 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
198 | if ( wlan->fromDS() && !wlan->toDS() ) | 200 | if ( wlan->fromDS() && !wlan->toDS() ) |
199 | { | 201 | { |
200 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 202 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
201 | } | 203 | } |
202 | else if ( !wlan->fromDS() && wlan->toDS() ) | 204 | else if ( !wlan->fromDS() && wlan->toDS() ) |
203 | { | 205 | { |
204 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); | 206 | netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); |
205 | } | 207 | } |
206 | else if ( wlan->fromDS() && wlan->toDS() ) | 208 | else if ( wlan->fromDS() && wlan->toDS() ) |
207 | { | 209 | { |
208 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 210 | netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
209 | } | 211 | } |
210 | else | 212 | else |
211 | { | 213 | { |
212 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); | 214 | netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); |
213 | } | 215 | } |
214 | 216 | ||
215 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 217 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
216 | if ( arp ) | 218 | if ( arp ) |
217 | { | 219 | { |
218 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 220 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); |
219 | if ( arp->type() == "REQUEST" ) | 221 | if ( arp->type() == "REQUEST" ) |
220 | { | 222 | { |
221 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 223 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
222 | } | 224 | } |
223 | else if ( arp->type() == "REPLY" ) | 225 | else if ( arp->type() == "REPLY" ) |
224 | { | 226 | { |
225 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 227 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
226 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 228 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
227 | } | 229 | } |
228 | } | 230 | } |
229 | 231 | ||