-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 85 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 88 |
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 | |||
@@ -5,48 +5,66 @@ | |||
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> |
26 | using namespace Opie; | 26 | using 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 | |||
36 | const int col_type = 0; | ||
37 | const int col_essid = 0; | ||
38 | const int col_sig = 1; | ||
39 | const int col_ap = 2; | ||
40 | const int col_channel = 3; | ||
41 | const int col_wep = 4; | ||
42 | const int col_traffic = 5; | ||
43 | const int col_manuf = 6; | ||
44 | const int col_firstseen = 7; | ||
45 | const int col_lastseen = 8; | ||
46 | |||
29 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 47 | MScanListView::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" ) ); |
@@ -84,49 +102,49 @@ void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) | |||
84 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 102 | void 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 ) ) |
@@ -152,64 +170,99 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
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 | 194 | void 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 | ||
182 | const int col_type = 0; | 198 | qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", |
183 | const int col_essid = 0; | 199 | (const char*) type, (const char*) from, |
184 | const int col_sig = 1; | 200 | (const char*) to, (const char*) via ); |
185 | const int col_ap = 2; | 201 | |
186 | const int col_channel = 3; | 202 | QString s; |
187 | const int col_wep = 4; | 203 | MScanListItem* network; |
188 | const int col_traffic = 5; | 204 | |
189 | const int col_manuf = 6; | 205 | QListViewItemIterator it( this ); |
190 | const int col_firstseen = 7; | 206 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
191 | const 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 | ||
193 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 246 | MScanListItem::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 | ||
205 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 258 | MScanListItem::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 | ||
213 | OListViewItem* MScanListItem::childFactory() | 266 | OListViewItem* MScanListItem::childFactory() |
214 | { | 267 | { |
215 | return new MScanListItem( this ); | 268 | return new MScanListItem( this ); |
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 | |||
@@ -18,48 +18,49 @@ | |||
18 | 18 | ||
19 | #include <opie2/olistview.h> | 19 | #include <opie2/olistview.h> |
20 | 20 | ||
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | 22 | ||
23 | class QString; | 23 | class QString; |
24 | class ManufacturerDB; | 24 | class ManufacturerDB; |
25 | 25 | ||
26 | class MScanListView: public OListView | 26 | class 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 | ||
50 | class MScanListItem: public OListViewItem | 51 | class 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, |
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 | |||
@@ -92,70 +92,118 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
92 | netview->setManufacturerDB( manufacturerdb ); | 92 | netview->setManufacturerDB( manufacturerdb ); |
93 | 93 | ||
94 | pcap = new OPacketCapturer(); | 94 | pcap = new OPacketCapturer(); |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | Wellenreiter::~Wellenreiter() | 98 | Wellenreiter::~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 | ||
106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
107 | { | 107 | { |
108 | configwindow = cw; | 108 | configwindow = cw; |
109 | } | 109 | } |
110 | 110 | ||
111 | void Wellenreiter::receivePacket(OPacket* p) | 111 | void 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 | ||
140 | void Wellenreiter::startStopClicked() | 188 | void 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 ); |