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.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 4b82c9a..c061319 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -37,48 +37,49 @@ using namespace Opie;
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39#include <qregexp.h> 39#include <qregexp.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43 43
44// Standard 44// Standard
45 45
46#include <assert.h> 46#include <assert.h>
47#include <errno.h> 47#include <errno.h>
48#include <unistd.h> 48#include <unistd.h>
49#include <string.h> 49#include <string.h>
50#include <sys/types.h> 50#include <sys/types.h>
51#include <stdlib.h> 51#include <stdlib.h>
52 52
53// Local 53// Local
54 54
55#include "wellenreiter.h" 55#include "wellenreiter.h"
56#include "scanlist.h" 56#include "scanlist.h"
57#include "logwindow.h" 57#include "logwindow.h"
58#include "hexwindow.h" 58#include "hexwindow.h"
59#include "configwindow.h" 59#include "configwindow.h"
60#include "statwindow.h" 60#include "statwindow.h"
61#include "graphwindow.h"
61#include "manufacturers.h" 62#include "manufacturers.h"
62 63
63Wellenreiter::Wellenreiter( QWidget* parent ) 64Wellenreiter::Wellenreiter( QWidget* parent )
64 : WellenreiterBase( parent, 0, 0 ), 65 : WellenreiterBase( parent, 0, 0 ),
65 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) 66 sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
66{ 67{
67 68
68 // 69 //
69 // construct manufacturer database 70 // construct manufacturer database
70 // 71 //
71 72
72 QString manufile; 73 QString manufile;
73 #ifdef QWS 74 #ifdef QWS
74 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); 75 manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
75 #else 76 #else
76 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); 77 manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" );
77 #endif 78 #endif
78 manufacturerdb = new ManufacturerDB( manufile ); 79 manufacturerdb = new ManufacturerDB( manufile );
79 80
80 logwindow->log( "(i) Wellenreiter has been started." ); 81 logwindow->log( "(i) Wellenreiter has been started." );
81 82
82 // 83 //
83 // detect operating system 84 // detect operating system
84 // 85 //
@@ -145,48 +146,54 @@ void Wellenreiter::receivePacket(OPacket* p)
145 if ( beacon && beacon->managementType() == "Beacon" ) 146 if ( beacon && beacon->managementType() == "Beacon" )
146 { 147 {
147 QString type; 148 QString type;
148 if ( beacon->canIBSS() ) 149 if ( beacon->canIBSS() )
149 { 150 {
150 type = "adhoc"; 151 type = "adhoc";
151 } 152 }
152 else if ( beacon->canESS() ) 153 else if ( beacon->canESS() )
153 { 154 {
154 type = "managed"; 155 type = "managed";
155 } 156 }
156 else 157 else
157 { 158 {
158 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); 159 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) );
159 return; 160 return;
160 } 161 }
161 162
162 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 163 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
163 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 164 QString essid = ssid ? ssid->ID() : QString("<unknown>");
164 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 165 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
165 int channel = ds ? ds->channel() : -1; 166 int channel = ds ? ds->channel() : -1;
166 167
167 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 168 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
168 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); 169 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 );
170
171 // do we have a prism header?
172 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
173 if ( ds && prism )
174 graphwindow->traffic( ds->channel(), prism->signalStrength() );
175
169 return; 176 return;
170 } 177 }
171 178
172 // check for a data frame 179 // check for a data frame
173 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); 180 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) );
174 if ( data ) 181 if ( data )
175 { 182 {
176 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 183 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
177 if ( wlan->fromDS() && !wlan->toDS() ) 184 if ( wlan->fromDS() && !wlan->toDS() )
178 { 185 {
179 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", 186 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'",
180 (const char*) wlan->macAddress3().toString(true), 187 (const char*) wlan->macAddress3().toString(true),
181 (const char*) wlan->macAddress1().toString(true), 188 (const char*) wlan->macAddress1().toString(true),
182 (const char*) wlan->macAddress2().toString(true) ); 189 (const char*) wlan->macAddress2().toString(true) );
183 netView()->fromDStraffic( wlan->macAddress3().toString(), 190 netView()->fromDStraffic( wlan->macAddress3().toString(),
184 wlan->macAddress1().toString(), 191 wlan->macAddress1().toString(),
185 wlan->macAddress2().toString() ); 192 wlan->macAddress2().toString() );
186 } 193 }
187 else 194 else
188 if ( !wlan->fromDS() && wlan->toDS() ) 195 if ( !wlan->fromDS() && wlan->toDS() )
189 { 196 {
190 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", 197 qDebug( "ToDS traffic: '%s' -> '%s' via '%s'",
191 (const char*) wlan->macAddress2().toString(true), 198 (const char*) wlan->macAddress2().toString(true),
192 (const char*) wlan->macAddress3().toString(true), 199 (const char*) wlan->macAddress3().toString(true),