summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-03-28 17:32:44 (UTC)
committer mickeyl <mickeyl>2004-03-28 17:32:44 (UTC)
commit1c151bedaa6cfcc8f10c7b5aa549de3e6628d271 (patch) (unidiff)
tree23cb7abf06ff3092e629095546f1171761321716
parente2368b92a101437f7ed289d5ae62f7e7e2466344 (diff)
downloadopie-1c151bedaa6cfcc8f10c7b5aa549de3e6628d271.zip
opie-1c151bedaa6cfcc8f10c7b5aa549de3e6628d271.tar.gz
opie-1c151bedaa6cfcc8f10c7b5aa549de3e6628d271.tar.bz2
add some FIXMEs for later API revisions
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp2
-rw-r--r--libopie2/opienet/opcap.h10
2 files changed, 7 insertions, 5 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index c5df041..93176c0 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -1,443 +1,445 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31/* OPIE */ 31/* OPIE */
32#include <opie2/opcap.h> 32#include <opie2/opcap.h>
33#include <opie2/odebug.h> 33#include <opie2/odebug.h>
34 34
35/* QT */ 35/* QT */
36#include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) 36#include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects)
37#include <qsocketnotifier.h> 37#include <qsocketnotifier.h>
38#include <qobjectlist.h> 38#include <qobjectlist.h>
39 39
40/* SYSTEM */ 40/* SYSTEM */
41#include <sys/time.h> 41#include <sys/time.h>
42#include <sys/types.h> 42#include <sys/types.h>
43#include <unistd.h> 43#include <unistd.h>
44 44
45/* LOCAL */ 45/* LOCAL */
46#include "udp_ports.h" 46#include "udp_ports.h"
47 47
48using namespace Opie::Core; 48using namespace Opie::Core;
49 49
50namespace Opie { 50namespace Opie {
51namespace Net { 51namespace Net {
52 52
53/*====================================================================================== 53/*======================================================================================
54 * OPacket 54 * OPacket
55 *======================================================================================*/ 55 *======================================================================================*/
56 56
57OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) 57OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent )
58 :QObject( parent, "Generic" ), _hdr( header ), _data( data ) 58 :QObject( parent, "Generic" ), _hdr( header ), _data( data )
59{ 59{
60 //FIXME: Copy the data structure here, because it isn't persistent. Check that.
61
60 qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); 62 qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen );
61 63
62 _end = (unsigned char*) data + header.len; 64 _end = (unsigned char*) data + header.len;
63 //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); 65 //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end );
64 66
65 switch ( datalink ) 67 switch ( datalink )
66 { 68 {
67 case DLT_EN10MB: 69 case DLT_EN10MB:
68 odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; 70 odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl;
69 new OEthernetPacket( _end, (const struct ether_header*) data, this ); 71 new OEthernetPacket( _end, (const struct ether_header*) data, this );
70 break; 72 break;
71 73
72 case DLT_IEEE802_11: 74 case DLT_IEEE802_11:
73 odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; 75 odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl;
74 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); 76 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this );
75 break; 77 break;
76 78
77 case DLT_PRISM_HEADER: 79 case DLT_PRISM_HEADER:
78 odebug << "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" << oendl; 80 odebug << "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" << oendl;
79 new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this ); 81 new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this );
80 break; 82 break;
81 83
82 default: 84 default:
83 owarn << "OPacket::OPacket(): Received Packet over unsupported datalink, type " << datalink << "!" << oendl; 85 owarn << "OPacket::OPacket(): Received Packet over unsupported datalink, type " << datalink << "!" << oendl;
84 } 86 }
85} 87}
86 88
87 89
88OPacket::~OPacket() 90OPacket::~OPacket()
89{ 91{
90 qDebug( "OPacket::~OPacket( %s )", name() ); 92 qDebug( "OPacket::~OPacket( %s )", name() );
91} 93}
92 94
93 95
94timevalstruct OPacket::timeval() const 96timevalstruct OPacket::timeval() const
95{ 97{
96 return _hdr.ts; 98 return _hdr.ts;
97} 99}
98 100
99 101
100int OPacket::caplen() const 102int OPacket::caplen() const
101{ 103{
102 return _hdr.caplen; 104 return _hdr.caplen;
103} 105}
104 106
105 107
106void OPacket::updateStats( QMap<QString,int>& stats, QObjectList* l ) 108void OPacket::updateStats( QMap<QString,int>& stats, QObjectList* l )
107{ 109{
108 if (!l) return; 110 if (!l) return;
109 QObject* o = l->first(); 111 QObject* o = l->first();
110 while ( o ) 112 while ( o )
111 { 113 {
112 stats[o->name()]++; 114 stats[o->name()]++;
113 updateStats( stats, const_cast<QObjectList*>( o->children() ) ); 115 updateStats( stats, const_cast<QObjectList*>( o->children() ) );
114 o = l->next(); 116 o = l->next();
115 } 117 }
116} 118}
117 119
118 120
119QString OPacket::dumpStructure() const 121QString OPacket::dumpStructure() const
120{ 122{
121 return "[ |" + _dumpStructure( const_cast<QObjectList*>( this->children() ) ) + " ]"; 123 return "[ |" + _dumpStructure( const_cast<QObjectList*>( this->children() ) ) + " ]";
122} 124}
123 125
124 126
125QString OPacket::_dumpStructure( QObjectList* l ) const 127QString OPacket::_dumpStructure( QObjectList* l ) const
126{ 128{
127 if (!l) return QString::null; 129 if (!l) return QString::null;
128 QObject* o = l->first(); 130 QObject* o = l->first();
129 QString str(" "); 131 QString str(" ");
130 132
131 while ( o ) 133 while ( o )
132 { 134 {
133 str.append( o->name() ); 135 str.append( o->name() );
134 str.append( " |" ); 136 str.append( " |" );
135 str += _dumpStructure( const_cast<QObjectList*>( o->children() ) ); 137 str += _dumpStructure( const_cast<QObjectList*>( o->children() ) );
136 o = l->next(); 138 o = l->next();
137 } 139 }
138 return str; 140 return str;
139} 141}
140 142
141QString OPacket::dump( int bpl ) const 143QString OPacket::dump( int bpl ) const
142{ 144{
143 static int index = 0; 145 static int index = 0;
144 index++; 146 index++;
145 int len = _hdr.caplen; 147 int len = _hdr.caplen;
146 QString str; 148 QString str;
147 str.sprintf( "\n<----- Packet #%04d Len = 0x%X (%d) ----->\n\n", index, len, len ); 149 str.sprintf( "\n<----- Packet #%04d Len = 0x%X (%d) ----->\n\n", index, len, len );
148 str.append( "0000: " ); 150 str.append( "0000: " );
149 QString tmp; 151 QString tmp;
150 QString bytes; 152 QString bytes;
151 QString chars; 153 QString chars;
152 154
153 for ( int i = 0; i < len; ++i ) 155 for ( int i = 0; i < len; ++i )
154 { 156 {
155 tmp.sprintf( "%02X ", _data[i] ); bytes.append( tmp ); 157 tmp.sprintf( "%02X ", _data[i] ); bytes.append( tmp );
156 if ( (_data[i] > 31) && (_data[i]<128) ) chars.append( _data[i] ); 158 if ( (_data[i] > 31) && (_data[i]<128) ) chars.append( _data[i] );
157 else chars.append( '.' ); 159 else chars.append( '.' );
158 160
159 if ( !((i+1) % bpl) ) 161 if ( !((i+1) % bpl) )
160 { 162 {
161 str.append( bytes ); 163 str.append( bytes );
162 str.append( ' ' ); 164 str.append( ' ' );
163 str.append( chars ); 165 str.append( chars );
164 str.append( '\n' ); 166 str.append( '\n' );
165 tmp.sprintf( "%04X: ", i+1 ); str.append( tmp ); 167 tmp.sprintf( "%04X: ", i+1 ); str.append( tmp );
166 bytes = ""; 168 bytes = "";
167 chars = ""; 169 chars = "";
168 } 170 }
169 171
170 } 172 }
171 if ( (len % bpl) ) 173 if ( (len % bpl) )
172 { 174 {
173 str.append( bytes.leftJustify( 1 + 3*bpl ) ); 175 str.append( bytes.leftJustify( 1 + 3*bpl ) );
174 str.append( chars ); 176 str.append( chars );
175 } 177 }
176 str.append( '\n' ); 178 str.append( '\n' );
177 return str; 179 return str;
178} 180}
179 181
180 182
181int OPacket::len() const 183int OPacket::len() const
182{ 184{
183 return _hdr.len; 185 return _hdr.len;
184} 186}
185 187
186 188
187QTextStream& operator<<( QTextStream& s, const OPacket& p ) 189QTextStream& operator<<( QTextStream& s, const OPacket& p )
188{ 190{
189 s << p.dumpStructure(); 191 s << p.dumpStructure();
190} 192}
191 193
192 194
193/*====================================================================================== 195/*======================================================================================
194 * OEthernetPacket 196 * OEthernetPacket
195 *======================================================================================*/ 197 *======================================================================================*/
196 198
197OEthernetPacket::OEthernetPacket( const unsigned char* end, const struct ether_header* data, QObject* parent ) 199OEthernetPacket::OEthernetPacket( const unsigned char* end, const struct ether_header* data, QObject* parent )
198 :QObject( parent, "Ethernet" ), _ether( data ) 200 :QObject( parent, "Ethernet" ), _ether( data )
199{ 201{
200 202
201 odebug << "Source = " << sourceAddress().toString(); 203 odebug << "Source = " << sourceAddress().toString();
202 odebug << "Destination = " << destinationAddress().toString(); 204 odebug << "Destination = " << destinationAddress().toString();
203 205
204 if ( sourceAddress() == OMacAddress::broadcast ) 206 if ( sourceAddress() == OMacAddress::broadcast )
205 odebug << "Source is broadcast address" << oendl; 207 odebug << "Source is broadcast address" << oendl;
206 if ( destinationAddress() == OMacAddress::broadcast ) 208 if ( destinationAddress() == OMacAddress::broadcast )
207 odebug << "Destination is broadcast address" << oendl; 209 odebug << "Destination is broadcast address" << oendl;
208 210
209 switch ( type() ) 211 switch ( type() )
210 { 212 {
211 case ETHERTYPE_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break; 213 case ETHERTYPE_IP: new OIPPacket( end, (const struct iphdr*) (data+1), this ); break;
212 case ETHERTYPE_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break; 214 case ETHERTYPE_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break;
213 case ETHERTYPE_REVARP: { odebug << "OPacket::OPacket(): Received Ethernet Packet : Type = RARP" << oendl; break; } 215 case ETHERTYPE_REVARP: { odebug << "OPacket::OPacket(): Received Ethernet Packet : Type = RARP" << oendl; break; }
214 default: odebug << "OPacket::OPacket(): Received Ethernet Packet : Type = UNKNOWN" << oendl; 216 default: odebug << "OPacket::OPacket(): Received Ethernet Packet : Type = UNKNOWN" << oendl;
215 } 217 }
216 218
217} 219}
218 220
219 221
220OEthernetPacket::~OEthernetPacket() 222OEthernetPacket::~OEthernetPacket()
221{ 223{
222} 224}
223 225
224 226
225OMacAddress OEthernetPacket::sourceAddress() const 227OMacAddress OEthernetPacket::sourceAddress() const
226{ 228{
227 return OMacAddress( _ether->ether_shost ); 229 return OMacAddress( _ether->ether_shost );
228} 230}
229 231
230 232
231OMacAddress OEthernetPacket::destinationAddress() const 233OMacAddress OEthernetPacket::destinationAddress() const
232{ 234{
233 return OMacAddress( _ether->ether_dhost ); 235 return OMacAddress( _ether->ether_dhost );
234} 236}
235 237
236int OEthernetPacket::type() const 238int OEthernetPacket::type() const
237{ 239{
238 return ntohs( _ether->ether_type ); 240 return ntohs( _ether->ether_type );
239} 241}
240 242
241 243
242/*====================================================================================== 244/*======================================================================================
243 * OIPPacket 245 * OIPPacket
244 *======================================================================================*/ 246 *======================================================================================*/
245 247
246 248
247OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObject* parent ) 249OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObject* parent )
248 :QObject( parent, "IP" ), _iphdr( data ) 250 :QObject( parent, "IP" ), _iphdr( data )
249{ 251{
250 odebug << "OIPPacket::OIPPacket(): decoding IP header..." << oendl; 252 odebug << "OIPPacket::OIPPacket(): decoding IP header..." << oendl;
251 253
252 odebug << "FromAddress = " << fromIPAddress().toString() << oendl; 254 odebug << "FromAddress = " << fromIPAddress().toString() << oendl;
253 odebug << " toAddress = " << toIPAddress().toString() << oendl; 255 odebug << " toAddress = " << toIPAddress().toString() << oendl;
254 256
255 switch ( protocol() ) 257 switch ( protocol() )
256 { 258 {
257 case IPPROTO_UDP: new OUDPPacket( end, (const struct udphdr*) (data+1), this ); break; 259 case IPPROTO_UDP: new OUDPPacket( end, (const struct udphdr*) (data+1), this ); break;
258 case IPPROTO_TCP: new OTCPPacket( end, (const struct tcphdr*) (data+1), this ); break; 260 case IPPROTO_TCP: new OTCPPacket( end, (const struct tcphdr*) (data+1), this ); break;
259 default: odebug << "OIPPacket::OIPPacket(): unknown IP protocol, type = " << protocol() << oendl; 261 default: odebug << "OIPPacket::OIPPacket(): unknown IP protocol, type = " << protocol() << oendl;
260 } 262 }
261 263
262} 264}
263 265
264OIPPacket::~OIPPacket() 266OIPPacket::~OIPPacket()
265{ 267{
266} 268}
267 269
268 270
269QHostAddress OIPPacket::fromIPAddress() const 271QHostAddress OIPPacket::fromIPAddress() const
270{ 272{
271 return EXTRACT_32BITS( &_iphdr->saddr ); 273 return EXTRACT_32BITS( &_iphdr->saddr );
272} 274}
273 275
274 276
275QHostAddress OIPPacket::toIPAddress() const 277QHostAddress OIPPacket::toIPAddress() const
276{ 278{
277 return EXTRACT_32BITS( &_iphdr->saddr ); 279 return EXTRACT_32BITS( &_iphdr->saddr );
278} 280}
279 281
280 282
281int OIPPacket::tos() const 283int OIPPacket::tos() const
282{ 284{
283 return _iphdr->tos; 285 return _iphdr->tos;
284} 286}
285 287
286 288
287int OIPPacket::len() const 289int OIPPacket::len() const
288{ 290{
289 return EXTRACT_16BITS( &_iphdr->tot_len ); 291 return EXTRACT_16BITS( &_iphdr->tot_len );
290} 292}
291 293
292 294
293int OIPPacket::id() const 295int OIPPacket::id() const
294{ 296{
295 return EXTRACT_16BITS( &_iphdr->id ); 297 return EXTRACT_16BITS( &_iphdr->id );
296} 298}
297 299
298 300
299int OIPPacket::offset() const 301int OIPPacket::offset() const
300{ 302{
301 return EXTRACT_16BITS( &_iphdr->frag_off ); 303 return EXTRACT_16BITS( &_iphdr->frag_off );
302} 304}
303 305
304 306
305int OIPPacket::ttl() const 307int OIPPacket::ttl() const
306{ 308{
307 return _iphdr->ttl; 309 return _iphdr->ttl;
308} 310}
309 311
310 312
311int OIPPacket::protocol() const 313int OIPPacket::protocol() const
312{ 314{
313 return _iphdr->protocol; 315 return _iphdr->protocol;
314} 316}
315 317
316 318
317int OIPPacket::checksum() const 319int OIPPacket::checksum() const
318{ 320{
319 return EXTRACT_16BITS( &_iphdr->check ); 321 return EXTRACT_16BITS( &_iphdr->check );
320} 322}
321 323
322/*====================================================================================== 324/*======================================================================================
323 * OARPPacket 325 * OARPPacket
324 *======================================================================================*/ 326 *======================================================================================*/
325 327
326 328
327OARPPacket::OARPPacket( const unsigned char* end, const struct myarphdr* data, QObject* parent ) 329OARPPacket::OARPPacket( const unsigned char* end, const struct myarphdr* data, QObject* parent )
328 :QObject( parent, "ARP" ), _arphdr( data ) 330 :QObject( parent, "ARP" ), _arphdr( data )
329{ 331{
330 odebug << "OARPPacket::OARPPacket(): decoding ARP header..." << oendl; 332 odebug << "OARPPacket::OARPPacket(): decoding ARP header..." << oendl;
331 odebug << "ARP type seems to be " << EXTRACT_16BITS( &_arphdr->ar_op ) << " = " << type() << oendl; 333 odebug << "ARP type seems to be " << EXTRACT_16BITS( &_arphdr->ar_op ) << " = " << type() << oendl;
332 odebug << "Sender: MAC " << senderMacAddress().toString() << " = IP " << senderIPV4Address().toString() << oendl; 334 odebug << "Sender: MAC " << senderMacAddress().toString() << " = IP " << senderIPV4Address().toString() << oendl;
333 odebug << "Target: MAC " << targetMacAddress().toString() << " = IP " << targetIPV4Address().toString() << oendl; 335 odebug << "Target: MAC " << targetMacAddress().toString() << " = IP " << targetIPV4Address().toString() << oendl;
334} 336}
335 337
336 338
337OARPPacket::~OARPPacket() 339OARPPacket::~OARPPacket()
338{ 340{
339} 341}
340 342
341 343
342QString OARPPacket::type() const 344QString OARPPacket::type() const
343{ 345{
344 switch ( EXTRACT_16BITS( &_arphdr->ar_op ) ) 346 switch ( EXTRACT_16BITS( &_arphdr->ar_op ) )
345 { 347 {
346 case 1: return "REQUEST"; 348 case 1: return "REQUEST";
347 case 2: return "REPLY"; 349 case 2: return "REPLY";
348 case 3: return "RREQUEST"; 350 case 3: return "RREQUEST";
349 case 4: return "RREPLY"; 351 case 4: return "RREPLY";
350 case 8: return "InREQUEST"; 352 case 8: return "InREQUEST";
351 case 9: return "InREPLY"; 353 case 9: return "InREPLY";
352 case 10: return "NAK"; 354 case 10: return "NAK";
353 default: owarn << "OARPPacket::type(): invalid ARP type!" << oendl; return "<unknown>"; 355 default: owarn << "OARPPacket::type(): invalid ARP type!" << oendl; return "<unknown>";
354 } 356 }
355} 357}
356 358
357 359
358QHostAddress OARPPacket::senderIPV4Address() const 360QHostAddress OARPPacket::senderIPV4Address() const
359{ 361{
360 return EXTRACT_32BITS( &_arphdr->ar_sip ); 362 return EXTRACT_32BITS( &_arphdr->ar_sip );
361} 363}
362 364
363 365
364QHostAddress OARPPacket::targetIPV4Address() const 366QHostAddress OARPPacket::targetIPV4Address() const
365{ 367{
366 return EXTRACT_32BITS( &_arphdr->ar_tip ); 368 return EXTRACT_32BITS( &_arphdr->ar_tip );
367} 369}
368 370
369 371
370OMacAddress OARPPacket::senderMacAddress() const 372OMacAddress OARPPacket::senderMacAddress() const
371{ 373{
372 return OMacAddress( _arphdr->ar_sha ); 374 return OMacAddress( _arphdr->ar_sha );
373} 375}
374 376
375 377
376OMacAddress OARPPacket::targetMacAddress() const 378OMacAddress OARPPacket::targetMacAddress() const
377{ 379{
378 return OMacAddress( _arphdr->ar_tha ); 380 return OMacAddress( _arphdr->ar_tha );
379} 381}
380 382
381 383
382/*====================================================================================== 384/*======================================================================================
383 * OUDPPacket 385 * OUDPPacket
384 *======================================================================================*/ 386 *======================================================================================*/
385 387
386 388
387OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent ) 389OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QObject* parent )
388 :QObject( parent, "UDP" ), _udphdr( data ) 390 :QObject( parent, "UDP" ), _udphdr( data )
389 391
390{ 392{
391 odebug << "OUDPPacket::OUDPPacket(): decoding UDP header..." << oendl; 393 odebug << "OUDPPacket::OUDPPacket(): decoding UDP header..." << oendl;
392 odebug << "fromPort = " << fromPort() << oendl; 394 odebug << "fromPort = " << fromPort() << oendl;
393 odebug << " toPort = " << toPort() << oendl; 395 odebug << " toPort = " << toPort() << oendl;
394 396
395 // TODO: Make this a case or a hash if we know more udp protocols 397 // TODO: Make this a case or a hash if we know more udp protocols
396 398
397 if ( fromPort() == UDP_PORT_BOOTPS || fromPort() == UDP_PORT_BOOTPC || 399 if ( fromPort() == UDP_PORT_BOOTPS || fromPort() == UDP_PORT_BOOTPC ||
398 toPort() == UDP_PORT_BOOTPS || toPort() == UDP_PORT_BOOTPC ) 400 toPort() == UDP_PORT_BOOTPS || toPort() == UDP_PORT_BOOTPC )
399 { 401 {
400 odebug << "seems to be part of a DHCP conversation => creating DHCP packet." << oendl; 402 odebug << "seems to be part of a DHCP conversation => creating DHCP packet." << oendl;
401 new ODHCPPacket( end, (const struct dhcp_packet*) (data+1), this ); 403 new ODHCPPacket( end, (const struct dhcp_packet*) (data+1), this );
402 } 404 }
403} 405}
404 406
405 407
406OUDPPacket::~OUDPPacket() 408OUDPPacket::~OUDPPacket()
407{ 409{
408} 410}
409 411
410 412
411int OUDPPacket::fromPort() const 413int OUDPPacket::fromPort() const
412{ 414{
413 return EXTRACT_16BITS( &_udphdr->source ); 415 return EXTRACT_16BITS( &_udphdr->source );
414} 416}
415 417
416 418
417int OUDPPacket::toPort() const 419int OUDPPacket::toPort() const
418{ 420{
419 return EXTRACT_16BITS( &_udphdr->dest ); 421 return EXTRACT_16BITS( &_udphdr->dest );
420} 422}
421 423
422 424
423int OUDPPacket::length() const 425int OUDPPacket::length() const
424{ 426{
425 return EXTRACT_16BITS( &_udphdr->len ); 427 return EXTRACT_16BITS( &_udphdr->len );
426} 428}
427 429
428 430
429int OUDPPacket::checksum() const 431int OUDPPacket::checksum() const
430{ 432{
431 return EXTRACT_16BITS( &_udphdr->check ); 433 return EXTRACT_16BITS( &_udphdr->check );
432} 434}
433 435
434 436
435/*====================================================================================== 437/*======================================================================================
436 * ODHCPPacket 438 * ODHCPPacket
437 *======================================================================================*/ 439 *======================================================================================*/
438 440
439 441
440ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* data, QObject* parent ) 442ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* data, QObject* parent )
441 :QObject( parent, "DHCP" ), _dhcphdr( data ) 443 :QObject( parent, "DHCP" ), _dhcphdr( data )
442 444
443{ 445{
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index 4ff8495..2dbe030 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -1,534 +1,534 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OPCAP_H 31#ifndef OPCAP_H
32#define OPCAP_H 32#define OPCAP_H
33 33
34/* OPIE */ 34/* OPIE */
35#include <opie2/onetutils.h> 35#include <opie2/onetutils.h>
36 36
37/* QT */ 37/* QT */
38#include <qevent.h> 38#include <qevent.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qhostaddress.h> 40#include <qhostaddress.h>
41#include <qobject.h> 41#include <qobject.h>
42#include <qstring.h> 42#include <qstring.h>
43#include <qtextstream.h> 43#include <qtextstream.h>
44#include <qmap.h> 44#include <qmap.h>
45 45
46/* STD */ 46/* STD */
47extern "C" // work around a bpf/pcap conflict in recent headers 47extern "C" // work around a bpf/pcap conflict in recent headers
48{ 48{
49 #include <pcap.h> 49 #include <pcap.h>
50} 50}
51#include <netinet/ether.h> 51#include <netinet/ether.h>
52#include <netinet/ip.h> 52#include <netinet/ip.h>
53#include <netinet/udp.h> 53#include <netinet/udp.h>
54#include <netinet/tcp.h> 54#include <netinet/tcp.h>
55#include <time.h> 55#include <time.h>
56 56
57/* Custom Network Includes (must go here, don't reorder!) */ 57/* Custom Network Includes (must go here, don't reorder!) */
58#include "802_11_user.h" 58#include "802_11_user.h"
59#include "dhcp.h" 59#include "dhcp.h"
60 60
61 61
62/* TYPEDEFS */ 62/* TYPEDEFS */
63typedef struct timeval timevalstruct; 63typedef struct timeval timevalstruct;
64typedef struct pcap_pkthdr packetheaderstruct; 64typedef struct pcap_pkthdr packetheaderstruct;
65 65
66/* FORWARDS */ 66/* FORWARDS */
67class QSocketNotifier; 67class QSocketNotifier;
68namespace Opie { 68namespace Opie {
69namespace Net { 69namespace Net {
70class OPacketCapturer; 70class OPacketCapturer;
71 71
72/*====================================================================================== 72/*======================================================================================
73 * OPacket - A frame on the wire 73 * OPacket - A frame on the wire
74 *======================================================================================*/ 74 *======================================================================================*/
75 75
76/** @brief A class representing a data frame on the wire. 76/** @brief A class representing a data frame on the wire.
77 * 77 *
78 * The whole family of the packet classes are used when capturing frames from a network. 78 * The whole family of the packet classes are used when capturing frames from a network.
79 * Most standard network protocols in use share a common architecture, which mostly is 79 * Most standard network protocols in use share a common architecture, which mostly is
80 * a packet header and then the packet payload. In layered architectures, each lower layer 80 * a packet header and then the packet payload. In layered architectures, each lower layer
81 * encapsulates data from its upper layer - that is it 81 * encapsulates data from its upper layer - that is it
82 * treats the data from its upper layer as payload and prepends an own header to the packet, 82 * treats the data from its upper layer as payload and prepends an own header to the packet,
83 * which - again - is treated as the payload for the layer below. The figure below is an 83 * which - again - is treated as the payload for the layer below. The figure below is an
84 * example for how such a data frame is composed out of packets, e.g. when sending a mail. 84 * example for how such a data frame is composed out of packets, e.g. when sending a mail.
85 * 85 *
86 * <pre> 86 * <pre>
87 * | User Data | == Mail Data 87 * | User Data | == Mail Data
88 * | SMTP Header | User Data | == SMTP 88 * | SMTP Header | User Data | == SMTP
89 * | TCP Header | SMTP Header | User Data | == TCP 89 * | TCP Header | SMTP Header | User Data | == TCP
90 * | IP Header | TCP Header | SMTP Header | User Data | == IP 90 * | IP Header | TCP Header | SMTP Header | User Data | == IP
91 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC 91 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC
92 * 92 *
93 * </pre> 93 * </pre>
94 * 94 *
95 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer 95 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer
96 * also contains a few more levels of encapsulation. 96 * also contains a few more levels of encapsulation.
97 * Since the type of the payload is more or less independent from the encapsulating protocol, 97 * Since the type of the payload is more or less independent from the encapsulating protocol,
98 * the header must be inspected before attempting to decode the payload. Hence, the 98 * the header must be inspected before attempting to decode the payload. Hence, the
99 * encapsulation level varies and can't be deduced without actually looking into the packets. 99 * encapsulation level varies and can't be deduced without actually looking into the packets.
100 * 100 *
101 * For actually working with captured frames, it's useful to identify the packets via names and 101 * For actually working with captured frames, it's useful to identify the packets via names and
102 * insert them into a parent/child - relationship based on the encapsulation. This is why 102 * insert them into a parent/child - relationship based on the encapsulation. This is why
103 * all packet classes derive from QObject. The amount of overhead caused by the QObject is 103 * all packet classes derive from QObject. The amount of overhead caused by the QObject is
104 * not a problem in this case, because we're talking about a theoratical maximum of about 104 * not a problem in this case, because we're talking about a theoratical maximum of about
105 * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the 105 * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the
106 * QObject also cares about destroying the sub-, (child-) packets. 106 * QObject also cares about destroying the sub-, (child-) packets.
107 * 107 *
108 * This enables us to perform a simple look for packets of a certain type: 108 * This enables us to perform a simple look for packets of a certain type:
109 * @code 109 * @code
110 * OPacketCapturer* pcap = new OPacketCapturer(); 110 * OPacketCapturer* pcap = new OPacketCapturer();
111 * pcap->open( "eth0" ); 111 * pcap->open( "eth0" );
112 * OPacket* p = pcap->next(); 112 * OPacket* p = pcap->next();
113 * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists 113 * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists
114 * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl; 114 * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl;
115 * 115 *
116 */ 116 */
117 117
118class OPacket : public QObject 118class OPacket : public QObject
119{ 119{
120 Q_OBJECT 120 Q_OBJECT
121 121
122 friend class OPacketCapturer; 122 friend class OPacketCapturer;
123 friend QTextStream& operator<<( QTextStream& s, const OPacket& p ); 123 friend QTextStream& operator<<( QTextStream& s, const OPacket& p );
124 124
125 public: 125 public:
126 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); 126 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent );
127 virtual ~OPacket(); 127 virtual ~OPacket();
128 128
129 timevalstruct timeval() const; 129 timevalstruct timeval() const;
130 130
131 int caplen() const; 131 int caplen() const;
132 int len() const; 132 int len() const;
133 QString dump( int = 32 ) const; 133 QString dump( int = 32 ) const; //FIXME: remove that
134 134
135 void updateStats( QMap<QString,int>&, QObjectList* ); 135 void updateStats( QMap<QString,int>&, QObjectList* ); //FIXME: Revise
136 136
137 QString dumpStructure() const; 137 QString dumpStructure() const; //FIXME: Revise
138 private: 138 private:
139 QString _dumpStructure( QObjectList* ) const; 139 QString _dumpStructure( QObjectList* ) const; //FIXME: Revise
140 140
141 private: 141 private:
142 const packetheaderstruct _hdr; // pcap packet header 142 const packetheaderstruct _hdr; // pcap packet header
143 const unsigned char* _data; // pcap packet data 143 const unsigned char* _data; // pcap packet data
144 const unsigned char* _end; // end of pcap packet data 144 const unsigned char* _end; // end of pcap packet data
145 private: 145 private:
146 class Private; 146 class Private;
147 Private *d; 147 Private *d;
148}; 148};
149 149
150QTextStream& operator<<( QTextStream& s, const OPacket& p ); 150QTextStream& operator<<( QTextStream& s, const OPacket& p ); //FIXME: Revise
151 151
152/*====================================================================================== 152/*======================================================================================
153 * OEthernetPacket - DLT_EN10MB frame 153 * OEthernetPacket - DLT_EN10MB frame
154 *======================================================================================*/ 154 *======================================================================================*/
155 155
156class OEthernetPacket : public QObject 156class OEthernetPacket : public QObject
157{ 157{
158 Q_OBJECT 158 Q_OBJECT
159 159
160 public: 160 public:
161 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); 161 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 );
162 virtual ~OEthernetPacket(); 162 virtual ~OEthernetPacket();
163 163
164 OMacAddress sourceAddress() const; 164 OMacAddress sourceAddress() const;
165 OMacAddress destinationAddress() const; 165 OMacAddress destinationAddress() const;
166 int type() const; 166 int type() const;
167 167
168 private: 168 private:
169 const struct ether_header* _ether; 169 const struct ether_header* _ether;
170 private: 170 private:
171 class Private; 171 class Private;
172 Private *d; 172 Private *d;
173}; 173};
174 174
175/*====================================================================================== 175/*======================================================================================
176 * OPrismHeaderPacket - DLT_PRISM_HEADER frame 176 * OPrismHeaderPacket - DLT_PRISM_HEADER frame
177 *======================================================================================*/ 177 *======================================================================================*/
178 178
179class OPrismHeaderPacket : public QObject 179class OPrismHeaderPacket : public QObject
180{ 180{
181 Q_OBJECT 181 Q_OBJECT
182 182
183 public: 183 public:
184 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); 184 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 );
185 virtual ~OPrismHeaderPacket(); 185 virtual ~OPrismHeaderPacket();
186 186
187 unsigned int signalStrength() const; 187 unsigned int signalStrength() const;
188 188
189 private: 189 private:
190 const struct prism_hdr* _header; 190 const struct prism_hdr* _header;
191 class Private; 191 class Private;
192 Private *d; 192 Private *d;
193}; 193};
194 194
195/*====================================================================================== 195/*======================================================================================
196 * OWaveLanPacket - DLT_IEEE802_11 frame 196 * OWaveLanPacket - DLT_IEEE802_11 frame
197 *======================================================================================*/ 197 *======================================================================================*/
198 198
199class OWaveLanPacket : public QObject 199class OWaveLanPacket : public QObject
200{ 200{
201 Q_OBJECT 201 Q_OBJECT
202 202
203 public: 203 public:
204 OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); 204 OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 );
205 virtual ~OWaveLanPacket(); 205 virtual ~OWaveLanPacket();
206 206
207 int duration() const; 207 int duration() const;
208 bool fromDS() const; 208 bool fromDS() const;
209 bool toDS() const; 209 bool toDS() const;
210 virtual OMacAddress macAddress1() const; 210 virtual OMacAddress macAddress1() const;
211 virtual OMacAddress macAddress2() const; 211 virtual OMacAddress macAddress2() const;
212 virtual OMacAddress macAddress3() const; 212 virtual OMacAddress macAddress3() const;
213 virtual OMacAddress macAddress4() const; 213 virtual OMacAddress macAddress4() const;
214 bool usesPowerManagement() const; 214 bool usesPowerManagement() const;
215 int type() const; 215 int type() const;
216 int subType() const; 216 int subType() const;
217 int version() const; 217 int version() const;
218 bool usesWep() const; 218 bool usesWep() const;
219 219
220 private: 220 private:
221 const struct ieee_802_11_header* _wlanhdr; 221 const struct ieee_802_11_header* _wlanhdr;
222 class Private; 222 class Private;
223 Private *d; 223 Private *d;
224}; 224};
225 225
226 226
227/*====================================================================================== 227/*======================================================================================
228 * OWaveLanManagementPacket - type: management (T_MGMT) 228 * OWaveLanManagementPacket - type: management (T_MGMT)
229 *======================================================================================*/ 229 *======================================================================================*/
230 230
231class OWaveLanManagementPacket : public QObject 231class OWaveLanManagementPacket : public QObject
232{ 232{
233 Q_OBJECT 233 Q_OBJECT
234 234
235 public: 235 public:
236 OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); 236 OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 );
237 virtual ~OWaveLanManagementPacket(); 237 virtual ~OWaveLanManagementPacket();
238 238
239 QString managementType() const; 239 QString managementType() const;
240 240
241 int beaconInterval() const; 241 int beaconInterval() const;
242 int capabilities() const; // generic 242 int capabilities() const; // generic
243 243
244 bool canESS() const; 244 bool canESS() const;
245 bool canIBSS() const; 245 bool canIBSS() const;
246 bool canCFP() const; 246 bool canCFP() const;
247 bool canCFP_REQ() const; 247 bool canCFP_REQ() const;
248 bool canPrivacy() const; 248 bool canPrivacy() const;
249 249
250 private: 250 private:
251 const struct ieee_802_11_mgmt_header* _header; 251 const struct ieee_802_11_mgmt_header* _header;
252 const struct ieee_802_11_mgmt_body* _body; 252 const struct ieee_802_11_mgmt_body* _body;
253 class Private; 253 class Private;
254 Private *d; 254 Private *d;
255}; 255};
256 256
257 257
258/*====================================================================================== 258/*======================================================================================
259 * OWaveLanManagementSSID 259 * OWaveLanManagementSSID
260 *======================================================================================*/ 260 *======================================================================================*/
261 261
262class OWaveLanManagementSSID : public QObject 262class OWaveLanManagementSSID : public QObject
263{ 263{
264 Q_OBJECT 264 Q_OBJECT
265 265
266 public: 266 public:
267 OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); 267 OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 );
268 virtual ~OWaveLanManagementSSID(); 268 virtual ~OWaveLanManagementSSID();
269 269
270 QString ID( bool decloak = false ) const; 270 QString ID( bool decloak = false ) const;
271 271
272 private: 272 private:
273 const struct ssid_t* _data; 273 const struct ssid_t* _data;
274 class Private; 274 class Private;
275 Private *d; 275 Private *d;
276}; 276};
277 277
278/*====================================================================================== 278/*======================================================================================
279 * OWaveLanManagementRates 279 * OWaveLanManagementRates
280 *======================================================================================*/ 280 *======================================================================================*/
281 281
282class OWaveLanManagementRates : public QObject 282class OWaveLanManagementRates : public QObject
283{ 283{
284 Q_OBJECT 284 Q_OBJECT
285 285
286 public: 286 public:
287 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); 287 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 );
288 virtual ~OWaveLanManagementRates(); 288 virtual ~OWaveLanManagementRates();
289 289
290 private: 290 private:
291 const struct rates_t* _data; 291 const struct rates_t* _data;
292 class Private; 292 class Private;
293 Private *d; 293 Private *d;
294}; 294};
295 295
296/*====================================================================================== 296/*======================================================================================
297 * OWaveLanManagementCF 297 * OWaveLanManagementCF
298 *======================================================================================*/ 298 *======================================================================================*/
299 299
300class OWaveLanManagementCF : public QObject 300class OWaveLanManagementCF : public QObject
301{ 301{
302 Q_OBJECT 302 Q_OBJECT
303 303
304 public: 304 public:
305 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); 305 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 );
306 virtual ~OWaveLanManagementCF(); 306 virtual ~OWaveLanManagementCF();
307 307
308 private: 308 private:
309 const struct cf_t* _data; 309 const struct cf_t* _data;
310 class Private; 310 class Private;
311 Private *d; 311 Private *d;
312}; 312};
313 313
314/*====================================================================================== 314/*======================================================================================
315 * OWaveLanManagementFH 315 * OWaveLanManagementFH
316 *======================================================================================*/ 316 *======================================================================================*/
317 317
318class OWaveLanManagementFH : public QObject 318class OWaveLanManagementFH : public QObject
319{ 319{
320 Q_OBJECT 320 Q_OBJECT
321 321
322 public: 322 public:
323 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); 323 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 );
324 virtual ~OWaveLanManagementFH(); 324 virtual ~OWaveLanManagementFH();
325 325
326 private: 326 private:
327 const struct fh_t* _data; 327 const struct fh_t* _data;
328 class Private; 328 class Private;
329 Private *d; 329 Private *d;
330}; 330};
331 331
332/*====================================================================================== 332/*======================================================================================
333 * OWaveLanManagementDS 333 * OWaveLanManagementDS
334 *======================================================================================*/ 334 *======================================================================================*/
335 335
336class OWaveLanManagementDS : public QObject 336class OWaveLanManagementDS : public QObject
337{ 337{
338 Q_OBJECT 338 Q_OBJECT
339 339
340 public: 340 public:
341 OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); 341 OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 );
342 virtual ~OWaveLanManagementDS(); 342 virtual ~OWaveLanManagementDS();
343 343
344 int channel() const; 344 int channel() const;
345 345
346 private: 346 private:
347 const struct ds_t* _data; 347 const struct ds_t* _data;
348 class Private; 348 class Private;
349 Private *d; 349 Private *d;
350}; 350};
351 351
352/*====================================================================================== 352/*======================================================================================
353 * OWaveLanManagementTim 353 * OWaveLanManagementTim
354 *======================================================================================*/ 354 *======================================================================================*/
355 355
356class OWaveLanManagementTim : public QObject 356class OWaveLanManagementTim : public QObject
357{ 357{
358 Q_OBJECT 358 Q_OBJECT
359 359
360 public: 360 public:
361 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); 361 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 );
362 virtual ~OWaveLanManagementTim(); 362 virtual ~OWaveLanManagementTim();
363 363
364 private: 364 private:
365 const struct tim_t* _data; 365 const struct tim_t* _data;
366 class Private; 366 class Private;
367 Private *d; 367 Private *d;
368}; 368};
369 369
370/*====================================================================================== 370/*======================================================================================
371 * OWaveLanManagementIBSS 371 * OWaveLanManagementIBSS
372 *======================================================================================*/ 372 *======================================================================================*/
373 373
374class OWaveLanManagementIBSS : public QObject 374class OWaveLanManagementIBSS : public QObject
375{ 375{
376 Q_OBJECT 376 Q_OBJECT
377 377
378 public: 378 public:
379 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); 379 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 );
380 virtual ~OWaveLanManagementIBSS(); 380 virtual ~OWaveLanManagementIBSS();
381 381
382 private: 382 private:
383 const struct ibss_t* _data; 383 const struct ibss_t* _data;
384 class Private; 384 class Private;
385 Private *d; 385 Private *d;
386}; 386};
387 387
388/*====================================================================================== 388/*======================================================================================
389 * OWaveLanManagementChallenge 389 * OWaveLanManagementChallenge
390 *======================================================================================*/ 390 *======================================================================================*/
391 391
392class OWaveLanManagementChallenge : public QObject 392class OWaveLanManagementChallenge : public QObject
393{ 393{
394 Q_OBJECT 394 Q_OBJECT
395 395
396 public: 396 public:
397 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); 397 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 );
398 virtual ~OWaveLanManagementChallenge(); 398 virtual ~OWaveLanManagementChallenge();
399 399
400 private: 400 private:
401 const struct challenge_t* _data; 401 const struct challenge_t* _data;
402 class Private; 402 class Private;
403 Private *d; 403 Private *d;
404}; 404};
405 405
406/*====================================================================================== 406/*======================================================================================
407 * OWaveLanDataPacket - type: data (T_DATA) 407 * OWaveLanDataPacket - type: data (T_DATA)
408 *======================================================================================*/ 408 *======================================================================================*/
409 409
410class OWaveLanDataPacket : public QObject 410class OWaveLanDataPacket : public QObject
411{ 411{
412 Q_OBJECT 412 Q_OBJECT
413 413
414 public: 414 public:
415 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); 415 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 );
416 virtual ~OWaveLanDataPacket(); 416 virtual ~OWaveLanDataPacket();
417 417
418 private: 418 private:
419 const struct ieee_802_11_data_header* _header; 419 const struct ieee_802_11_data_header* _header;
420 class Private; 420 class Private;
421 Private *d; 421 Private *d;
422}; 422};
423 423
424/*====================================================================================== 424/*======================================================================================
425 * OWaveLanControlPacket - type: control (T_CTRL) 425 * OWaveLanControlPacket - type: control (T_CTRL)
426 *======================================================================================*/ 426 *======================================================================================*/
427 427
428class OWaveLanControlPacket : public QObject 428class OWaveLanControlPacket : public QObject
429{ 429{
430 Q_OBJECT 430 Q_OBJECT
431 431
432 public: 432 public:
433 OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); 433 OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 );
434 virtual ~OWaveLanControlPacket(); 434 virtual ~OWaveLanControlPacket();
435 435
436 QString controlType() const; 436 QString controlType() const;
437 437
438 private: 438 private:
439 const struct ieee_802_11_control_header* _header; 439 const struct ieee_802_11_control_header* _header;
440 class Private; 440 class Private;
441 Private *d; 441 Private *d;
442}; 442};
443 443
444/*====================================================================================== 444/*======================================================================================
445 * OLLCPacket - IEEE 802.2 Link Level Control 445 * OLLCPacket - IEEE 802.2 Link Level Control
446 *======================================================================================*/ 446 *======================================================================================*/
447 447
448class OLLCPacket : public QObject 448class OLLCPacket : public QObject
449{ 449{
450 Q_OBJECT 450 Q_OBJECT
451 451
452 public: 452 public:
453 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); 453 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 );
454 virtual ~OLLCPacket(); 454 virtual ~OLLCPacket();
455 455
456 private: 456 private:
457 const struct ieee_802_11_802_2_header* _header; 457 const struct ieee_802_11_802_2_header* _header;
458 class Private; 458 class Private;
459 Private *d; 459 Private *d;
460}; 460};
461 461
462/*====================================================================================== 462/*======================================================================================
463 * OIPPacket 463 * OIPPacket
464 *======================================================================================*/ 464 *======================================================================================*/
465 465
466class OIPPacket : public QObject 466class OIPPacket : public QObject
467{ 467{
468 Q_OBJECT 468 Q_OBJECT
469 469
470 public: 470 public:
471 OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); 471 OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 );
472 virtual ~OIPPacket(); 472 virtual ~OIPPacket();
473 473
474 QHostAddress fromIPAddress() const; 474 QHostAddress fromIPAddress() const;
475 QHostAddress toIPAddress() const; 475 QHostAddress toIPAddress() const;
476 476
477 int tos() const; 477 int tos() const;
478 int len() const; 478 int len() const;
479 int id() const; 479 int id() const;
480 int offset() const; 480 int offset() const;
481 int ttl() const; 481 int ttl() const;
482 int protocol() const; 482 int protocol() const;
483 int checksum() const; 483 int checksum() const;
484 484
485 private: 485 private:
486 const struct iphdr* _iphdr; 486 const struct iphdr* _iphdr;
487 class Private; 487 class Private;
488 Private *d; 488 Private *d;
489}; 489};
490 490
491/*====================================================================================== 491/*======================================================================================
492 * OARPPacket 492 * OARPPacket
493 *======================================================================================*/ 493 *======================================================================================*/
494 494
495class OARPPacket : public QObject 495class OARPPacket : public QObject
496{ 496{
497 Q_OBJECT 497 Q_OBJECT
498 498
499 public: 499 public:
500 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); 500 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 );
501 virtual ~OARPPacket(); 501 virtual ~OARPPacket();
502 502
503 QHostAddress senderIPV4Address() const; 503 QHostAddress senderIPV4Address() const;
504 OMacAddress senderMacAddress() const; 504 OMacAddress senderMacAddress() const;
505 QHostAddress targetIPV4Address() const; 505 QHostAddress targetIPV4Address() const;
506 OMacAddress targetMacAddress() const; 506 OMacAddress targetMacAddress() const;
507 507
508 //int type() const; 508 //int type() const;
509 QString type() const; 509 QString type() const;
510 510
511 private: 511 private:
512 const struct myarphdr* _arphdr; 512 const struct myarphdr* _arphdr;
513 class Private; 513 class Private;
514 Private *d; 514 Private *d;
515}; 515};
516 516
517/*====================================================================================== 517/*======================================================================================
518 * OUDPPacket 518 * OUDPPacket
519 *======================================================================================*/ 519 *======================================================================================*/
520 520
521class OUDPPacket : public QObject 521class OUDPPacket : public QObject
522{ 522{
523 Q_OBJECT 523 Q_OBJECT
524 524
525 public: 525 public:
526 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); 526 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 );
527 virtual ~OUDPPacket(); 527 virtual ~OUDPPacket();
528 528
529 int fromPort() const; 529 int fromPort() const;
530 int toPort() const; 530 int toPort() const;
531 int length() const; 531 int length() const;
532 int checksum() const; 532 int checksum() const;
533 533
534 private: 534 private: