summaryrefslogtreecommitdiff
path: root/libopie2/opienet
Unidiff
Diffstat (limited to 'libopie2/opienet') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/802_11_user.h1
-rw-r--r--libopie2/opienet/dhcp.h2
-rw-r--r--libopie2/opienet/odebugmapper.cpp10
-rw-r--r--libopie2/opienet/odebugmapper.h10
-rw-r--r--libopie2/opienet/omanufacturerdb.cpp7
-rw-r--r--libopie2/opienet/omanufacturerdb.h8
-rw-r--r--libopie2/opienet/onetutils.cpp9
-rw-r--r--libopie2/opienet/onetutils.h15
-rw-r--r--libopie2/opienet/onetwork.cpp9
-rw-r--r--libopie2/opienet/onetwork.h31
-rw-r--r--libopie2/opienet/opcap.cpp8
-rw-r--r--libopie2/opienet/opcap.h52
-rw-r--r--libopie2/opienet/ostation.cpp8
-rw-r--r--libopie2/opienet/ostation.h9
14 files changed, 176 insertions, 3 deletions
diff --git a/libopie2/opienet/802_11_user.h b/libopie2/opienet/802_11_user.h
index 7ae27c5..1a9a7a0 100644
--- a/libopie2/opienet/802_11_user.h
+++ b/libopie2/opienet/802_11_user.h
@@ -452,7 +452,8 @@ struct ctrl_end_ack_t {
452 #define CTRL_END_ACK_LEN(2+2+6+6+4) 452 #define CTRL_END_ACK_LEN(2+2+6+6+4)
453 453
454 #define IV_IV(iv)((iv) & 0xFFFFFF) 454 #define IV_IV(iv)((iv) & 0xFFFFFF)
455 #define IV_PAD(iv)(((iv) >> 24) & 0x3F) 455 #define IV_PAD(iv)(((iv) >> 24) & 0x3F)
456 #define IV_KEYID(iv)(((iv) >> 30) & 0x03) 456 #define IV_KEYID(iv)(((iv) >> 30) & 0x03)
457 457
458
458#endif 459#endif
diff --git a/libopie2/opienet/dhcp.h b/libopie2/opienet/dhcp.h
index 368e375..6ba4c53 100644
--- a/libopie2/opienet/dhcp.h
+++ b/libopie2/opienet/dhcp.h
@@ -39,12 +39,13 @@
39 * To learn more about Vixie Enterprises, see ``http://www.vix.com''. 39 * To learn more about Vixie Enterprises, see ``http://www.vix.com''.
40 */ 40 */
41 41
42#ifndef DHCP_H 42#ifndef DHCP_H
43#define DHCP_H 43#define DHCP_H
44 44
45
45 #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ 46 #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \
46 20 + /* IP header */ \ 47 20 + /* IP header */ \
47 8) /* UDP header */ 48 8) /* UDP header */
48 #define DHCP_SNAME_LEN 64 49 #define DHCP_SNAME_LEN 64
49 #define DHCP_FILE_LEN 128 50 #define DHCP_FILE_LEN 128
50 #define DHCP_FIXED_NON_UDP236 51 #define DHCP_FIXED_NON_UDP236
@@ -194,8 +195,9 @@ struct dhcp_packet {
194 #define FQDN_RCODE2 5 195 #define FQDN_RCODE2 5
195 #define FQDN_HOSTNAME 6 196 #define FQDN_HOSTNAME 6
196 #define FQDN_DOMAINNAME 7 197 #define FQDN_DOMAINNAME 7
197 #define FQDN_FQDN 8 198 #define FQDN_FQDN 8
198 #define FQDN_SUBOPTION_COUNT 8 199 #define FQDN_SUBOPTION_COUNT 8
199 200
201
200#endif 202#endif
201 203
diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp
index 7e4ab2b..f679afb 100644
--- a/libopie2/opienet/odebugmapper.cpp
+++ b/libopie2/opienet/odebugmapper.cpp
@@ -4,12 +4,18 @@
4 */ 4 */
5 5
6#include <opie2/odebug.h> 6#include <opie2/odebug.h>
7 7
8#include "odebugmapper.h" 8#include "odebugmapper.h"
9 9
10using namespace Opie::Core;
11
12namespace Opie {
13namespace Net {
14namespace Private {
15
10DebugMapper::DebugMapper() 16DebugMapper::DebugMapper()
11{ 17{
12 odebug << "DebugMapper::DebugMapper()" << oendl; 18 odebug << "DebugMapper::DebugMapper()" << oendl;
13 19
14 20
15 _map.insert( 0x8902, new QString("SIOCSPGRP") ); 21 _map.insert( 0x8902, new QString("SIOCSPGRP") );
@@ -209,7 +215,9 @@ const QString& DebugMapper::map( int value ) const
209 else 215 else
210 { 216 {
211 return *result; 217 return *result;
212 } 218 }
213} 219}
214 220
215 221}
222}
223}
diff --git a/libopie2/opienet/odebugmapper.h b/libopie2/opienet/odebugmapper.h
index 66b331d..f47db47 100644
--- a/libopie2/opienet/odebugmapper.h
+++ b/libopie2/opienet/odebugmapper.h
@@ -6,21 +6,31 @@
6#ifndef DEBUGMAPPER_H 6#ifndef DEBUGMAPPER_H
7#define DEBUGMAPPER_H 7#define DEBUGMAPPER_H
8 8
9#include <qstring.h> 9#include <qstring.h>
10#include <qintdict.h> 10#include <qintdict.h>
11 11
12namespace Opie {
13namespace Net {
14namespace Private {
15
12typedef QIntDict<QString> IntStringMap; 16typedef QIntDict<QString> IntStringMap;
13 17
14class DebugMapper 18class DebugMapper
15{ 19{
16 public: 20 public:
17 DebugMapper(); 21 DebugMapper();
18 ~DebugMapper(); 22 ~DebugMapper();
19 23
20 const QString& map( int value ) const; 24 const QString& map( int value ) const;
21 private: 25 private:
22 IntStringMap _map; 26 IntStringMap _map;
27 class Private;
28 Private *d;
23}; 29};
24 30
31}
32}
33}
34
25#endif 35#endif
26 36
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp
index b93b752..209ec94 100644
--- a/libopie2/opienet/omanufacturerdb.cpp
+++ b/libopie2/opienet/omanufacturerdb.cpp
@@ -40,12 +40,16 @@
40 40
41/* QT */ 41/* QT */
42#include <qapplication.h> 42#include <qapplication.h>
43#include <qfile.h> 43#include <qfile.h>
44#include <qtextstream.h> 44#include <qtextstream.h>
45 45
46using namespace Opie::Core;
47namespace Opie {
48namespace Net {
49
46OManufacturerDB* OManufacturerDB::_instance = 0; 50OManufacturerDB* OManufacturerDB::_instance = 0;
47 51
48OManufacturerDB* OManufacturerDB::instance() 52OManufacturerDB* OManufacturerDB::instance()
49{ 53{
50 if ( !OManufacturerDB::_instance ) 54 if ( !OManufacturerDB::_instance )
51 { 55 {
@@ -130,6 +134,9 @@ const QString& OManufacturerDB::lookup( const QString& macaddr ) const
130const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const 134const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const
131{ 135{
132 QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); 136 QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) );
133 return it == manufacturersExt.end() ? lookup( macaddr ) : *it; 137 return it == manufacturersExt.end() ? lookup( macaddr ) : *it;
134} 138}
135 139
140}
141}
142
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h
index c2712e5..5c1940e 100644
--- a/libopie2/opienet/omanufacturerdb.h
+++ b/libopie2/opienet/omanufacturerdb.h
@@ -30,12 +30,15 @@
30 30
31#ifndef OMANUFACTURERDB_H 31#ifndef OMANUFACTURERDB_H
32#define OMANUFACTURERDB_H 32#define OMANUFACTURERDB_H
33 33
34#include <qmap.h> 34#include <qmap.h>
35 35
36namespace Opie {
37namespace Net {
38
36/** 39/**
37 * @brief A Ethernet card vendor database. 40 * @brief A Ethernet card vendor database.
38 * 41 *
39 * This class encapsulates the lookup of Ethernet vendor given a 42 * This class encapsulates the lookup of Ethernet vendor given a
40 * certain Mac Address. Only the first three bytes define the vendor. 43 * certain Mac Address. Only the first three bytes define the vendor.
41 */ 44 */
@@ -60,10 +63,15 @@ class OManufacturerDB
60 virtual ~OManufacturerDB(); 63 virtual ~OManufacturerDB();
61 64
62 private: 65 private:
63 QMap<QString, QString> manufacturers; 66 QMap<QString, QString> manufacturers;
64 QMap<QString, QString> manufacturersExt; 67 QMap<QString, QString> manufacturersExt;
65 static OManufacturerDB* _instance; 68 static OManufacturerDB* _instance;
69 class Private;
70 Private *d;
66}; 71};
67 72
73}
74}
75
68#endif 76#endif
69 77
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp
index 48cfa43..7794334 100644
--- a/libopie2/opienet/onetutils.cpp
+++ b/libopie2/opienet/onetutils.cpp
@@ -34,12 +34,15 @@
34#include <opie2/omanufacturerdb.h> 34#include <opie2/omanufacturerdb.h>
35 35
36#include <net/if.h> 36#include <net/if.h>
37#include <assert.h> 37#include <assert.h>
38#include <stdio.h> 38#include <stdio.h>
39 39
40namespace Opie {
41namespace Net {
42
40/*====================================================================================== 43/*======================================================================================
41 * OMacAddress 44 * OMacAddress
42 *======================================================================================*/ 45 *======================================================================================*/
43 46
44// static initializer for broadcast and unknown MAC Adresses 47// static initializer for broadcast and unknown MAC Adresses
45const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 48const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -182,12 +185,15 @@ void OPrivateIOCTL::invoke() const
182void OPrivateIOCTL::setParameter( int num, u_int32_t value ) 185void OPrivateIOCTL::setParameter( int num, u_int32_t value )
183{ 186{
184 u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; 187 u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name;
185 arglist[num] = value; 188 arglist[num] = value;
186} 189}
187 190
191
192
193namespace Private {
188/*====================================================================================== 194/*======================================================================================
189 * assorted functions 195 * assorted functions
190 *======================================================================================*/ 196 *======================================================================================*/
191 197
192void dumpBytes( const unsigned char* data, int num ) 198void dumpBytes( const unsigned char* data, int num )
193{ 199{
@@ -227,6 +233,9 @@ QString modeToString( int mode )
227 case IW_MODE_REPEAT: return "repeater"; 233 case IW_MODE_REPEAT: return "repeater";
228 case IW_MODE_SECOND: return "second"; 234 case IW_MODE_SECOND: return "second";
229 case IW_MODE_MONITOR: return "monitor"; 235 case IW_MODE_MONITOR: return "monitor";
230 default: assert( 0 ); 236 default: assert( 0 );
231 } 237 }
232} 238}
239}
240}
241}
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h
index bddfab9..ca6815d 100644
--- a/libopie2/opienet/onetutils.h
+++ b/libopie2/opienet/onetutils.h
@@ -38,12 +38,16 @@
38#include <qhostaddress.h> 38#include <qhostaddress.h>
39#include <qobject.h> 39#include <qobject.h>
40 40
41#include <sys/types.h> 41#include <sys/types.h>
42 42
43struct ifreq; 43struct ifreq;
44
45namespace Opie {
46namespace Net {
47
44class OWirelessNetworkInterface; 48class OWirelessNetworkInterface;
45 49
46/*====================================================================================== 50/*======================================================================================
47 * OMacAddress 51 * OMacAddress
48 *======================================================================================*/ 52 *======================================================================================*/
49 53
@@ -69,12 +73,14 @@ class OMacAddress
69 static const OMacAddress& unknown; // 44:44:44:44:44:44 73 static const OMacAddress& unknown; // 44:44:44:44:44:44
70 74
71 private: 75 private:
72 unsigned char _bytes[6]; 76 unsigned char _bytes[6];
73 77
74 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 78 friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
79 class Private;
80 Private *d;
75 81
76}; 82};
77 83
78bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); 84bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
79 85
80 86
@@ -85,12 +91,15 @@ bool operator==( const OMacAddress &m1, const OMacAddress &m2 );
85class OHostAddress : public QHostAddress 91class OHostAddress : public QHostAddress
86{ 92{
87 /*public: 93 /*public:
88 OHostAddress(); 94 OHostAddress();
89 ~OHostAddress(); 95 ~OHostAddress();
90 */ 96 */
97 private:
98 class Private;
99 Private *d;
91}; 100};
92 101
93 102
94/*====================================================================================== 103/*======================================================================================
95 * OPrivateIOCTL 104 * OPrivateIOCTL
96 *======================================================================================*/ 105 *======================================================================================*/
@@ -112,21 +121,27 @@ class OPrivateIOCTL : public QObject
112 121
113 private: 122 private:
114 u_int32_t _ioctl; 123 u_int32_t _ioctl;
115 u_int16_t _getargs; 124 u_int16_t _getargs;
116 u_int16_t _setargs; 125 u_int16_t _setargs;
117 126
127 class Private;
128 Private *d;
118}; 129};
119 130
120 /*====================================================================================== 131 /*======================================================================================
121 * Miscellaneous 132 * Miscellaneous
122 *======================================================================================*/ 133 *======================================================================================*/
123 134
135namespace Private {
124void dumpBytes( const unsigned char* data, int num ); 136void dumpBytes( const unsigned char* data, int num );
125QString modeToString( int ); 137QString modeToString( int );
126int stringToMode( const QString& ); 138int stringToMode( const QString& );
139}
140}
141}
127 142
128#define IW_PRIV_TYPE_MASK 0x7000 143#define IW_PRIV_TYPE_MASK 0x7000
129#define IW_PRIV_TYPE_NONE 0x0000 144#define IW_PRIV_TYPE_NONE 0x0000
130#define IW_PRIV_TYPE_BYTE 0x1000 145#define IW_PRIV_TYPE_BYTE 0x1000
131#define IW_PRIV_TYPE_CHAR 0x2000 146#define IW_PRIV_TYPE_CHAR 0x2000
132#define IW_PRIV_TYPE_INT 0x4000 147#define IW_PRIV_TYPE_INT 0x4000
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index e5b091f..ab3e77f 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -54,19 +54,25 @@
54#include <linux/sockios.h> 54#include <linux/sockios.h>
55#include <net/if_arp.h> 55#include <net/if_arp.h>
56#include <stdarg.h> 56#include <stdarg.h>
57 57
58#ifndef NODEBUG 58#ifndef NODEBUG
59#include <opie2/odebugmapper.h> 59#include <opie2/odebugmapper.h>
60
61
62using namespace Opie::Core;
63using namespace Opie::Net::Private;
60DebugMapper* debugmapper = new DebugMapper(); 64DebugMapper* debugmapper = new DebugMapper();
61#endif 65#endif
62 66
63/*====================================================================================== 67/*======================================================================================
64 * ONetwork 68 * ONetwork
65 *======================================================================================*/ 69 *======================================================================================*/
66 70
71namespace Opie {
72namespace Net {
67ONetwork* ONetwork::_instance = 0; 73ONetwork* ONetwork::_instance = 0;
68 74
69ONetwork::ONetwork() 75ONetwork::ONetwork()
70{ 76{
71 odebug << "ONetwork::ONetwork()" << oendl; 77 odebug << "ONetwork::ONetwork()" << oendl;
72 odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; 78 odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl;
@@ -1234,6 +1240,9 @@ void OOrinocoMonitoringInterface::setEnabled( bool b )
1234 1240
1235 1241
1236QString OOrinocoMonitoringInterface::name() const 1242QString OOrinocoMonitoringInterface::name() const
1237{ 1243{
1238 return "orinoco"; 1244 return "orinoco";
1239} 1245}
1246
1247}
1248}
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h
index 93b129f..a953296 100644
--- a/libopie2/opienet/onetwork.h
+++ b/libopie2/opienet/onetwork.h
@@ -53,12 +53,15 @@
53#include <qvaluelist.h> 53#include <qvaluelist.h>
54#include <qdict.h> 54#include <qdict.h>
55#include <qmap.h> 55#include <qmap.h>
56#include <qobject.h> 56#include <qobject.h>
57#include <qhostaddress.h> 57#include <qhostaddress.h>
58 58
59namespace Opie {
60namespace Net {
61
59class ONetworkInterface; 62class ONetworkInterface;
60class OWirelessNetworkInterface; 63class OWirelessNetworkInterface;
61class OChannelHopper; 64class OChannelHopper;
62class OMonitoringInterface; 65class OMonitoringInterface;
63 66
64/*====================================================================================== 67/*======================================================================================
@@ -120,12 +123,14 @@ class ONetwork : public QObject
120 protected: 123 protected:
121 ONetwork(); 124 ONetwork();
122 125
123 private: 126 private:
124 static ONetwork* _instance; 127 static ONetwork* _instance;
125 InterfaceMap _interfaces; 128 InterfaceMap _interfaces;
129 class Private;
130 Private *d;
126}; 131};
127 132
128 133
129/*====================================================================================== 134/*======================================================================================
130 * ONetworkInterface 135 * ONetworkInterface
131 *======================================================================================*/ 136 *======================================================================================*/
@@ -231,12 +236,15 @@ class ONetworkInterface : public QObject
231 236
232 protected: 237 protected:
233 struct ifreq& ifr() const; 238 struct ifreq& ifr() const;
234 virtual void init(); 239 virtual void init();
235 bool ioctl( int call ) const; 240 bool ioctl( int call ) const;
236 bool ioctl( int call, struct ifreq& ) const; 241 bool ioctl( int call, struct ifreq& ) const;
242 private:
243 class Private;
244 Private *d;
237}; 245};
238 246
239/*====================================================================================== 247/*======================================================================================
240 * OChannelHopper 248 * OChannelHopper
241 *======================================================================================*/ 249 *======================================================================================*/
242 250
@@ -293,12 +301,14 @@ class OChannelHopper : public QObject
293 private: 301 private:
294 OWirelessNetworkInterface* _iface; 302 OWirelessNetworkInterface* _iface;
295 int _interval; 303 int _interval;
296 int _tid; 304 int _tid;
297 QValueList<int> _channels; 305 QValueList<int> _channels;
298 QValueList<int>::Iterator _channel; 306 QValueList<int>::Iterator _channel;
307 class Private;
308 Private *d;
299}; 309};
300 310
301 311
302/*====================================================================================== 312/*======================================================================================
303 * OWirelessNetworkInterface 313 * OWirelessNetworkInterface
304 *======================================================================================*/ 314 *======================================================================================*/
@@ -452,12 +462,14 @@ class OWirelessNetworkInterface : public ONetworkInterface
452 mutable struct iwreq _iwr; 462 mutable struct iwreq _iwr;
453 QMap<int,int> _channels; 463 QMap<int,int> _channels;
454 struct iw_range _range; 464 struct iw_range _range;
455 465
456 private: 466 private:
457 OChannelHopper* _hopper; 467 OChannelHopper* _hopper;
468 class Private;
469 Private *d;
458}; 470};
459 471
460 472
461/*====================================================================================== 473/*======================================================================================
462 * OMonitoringInterface 474 * OMonitoringInterface
463 *======================================================================================*/ 475 *======================================================================================*/
@@ -476,12 +488,15 @@ class OMonitoringInterface
476 488
477 virtual QString name() const = 0; 489 virtual QString name() const = 0;
478 490
479 protected: 491 protected:
480 OWirelessNetworkInterface* _if; 492 OWirelessNetworkInterface* _if;
481 bool _prismHeader; 493 bool _prismHeader;
494 private:
495 class Private;
496 Private *d;
482 497
483}; 498};
484 499
485 500
486/*====================================================================================== 501/*======================================================================================
487 * OCiscoMonitoring 502 * OCiscoMonitoring
@@ -494,12 +509,15 @@ class OCiscoMonitoringInterface : public OMonitoringInterface
494 OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); 509 OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader );
495 virtual ~OCiscoMonitoringInterface(); 510 virtual ~OCiscoMonitoringInterface();
496 511
497 virtual void setEnabled( bool ); 512 virtual void setEnabled( bool );
498 virtual QString name() const; 513 virtual QString name() const;
499 virtual void setChannel( int ); 514 virtual void setChannel( int );
515 private:
516 class Private;
517 Private *d;
500 518
501}; 519};
502 520
503 521
504/*====================================================================================== 522/*======================================================================================
505 * OWlanNGMonitoringInterface 523 * OWlanNGMonitoringInterface
@@ -513,12 +531,15 @@ class OWlanNGMonitoringInterface : public OMonitoringInterface
513 virtual ~OWlanNGMonitoringInterface(); 531 virtual ~OWlanNGMonitoringInterface();
514 532
515 public: 533 public:
516 virtual void setEnabled( bool ); 534 virtual void setEnabled( bool );
517 virtual QString name() const; 535 virtual QString name() const;
518 virtual void setChannel( int ); 536 virtual void setChannel( int );
537 private:
538 class Private;
539 Private *d;
519 540
520}; 541};
521 542
522 543
523/*====================================================================================== 544/*======================================================================================
524 * OHostAPMonitoringInterface 545 * OHostAPMonitoringInterface
@@ -531,12 +552,16 @@ class OHostAPMonitoringInterface : public OMonitoringInterface
531 OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); 552 OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader );
532 virtual ~OHostAPMonitoringInterface(); 553 virtual ~OHostAPMonitoringInterface();
533 554
534 public: 555 public:
535 virtual void setEnabled( bool ); 556 virtual void setEnabled( bool );
536 virtual QString name() const; 557 virtual QString name() const;
558
559 private:
560 class Private;
561 Private *d;
537 }; 562 };
538 563
539 564
540/*====================================================================================== 565/*======================================================================================
541 * OOrinocoMonitoringInterface 566 * OOrinocoMonitoringInterface
542 *======================================================================================*/ 567 *======================================================================================*/
@@ -550,10 +575,16 @@ class OOrinocoMonitoringInterface : public OMonitoringInterface
550 575
551 public: 576 public:
552 virtual void setChannel( int ); 577 virtual void setChannel( int );
553 virtual void setEnabled( bool ); 578 virtual void setEnabled( bool );
554 virtual QString name() const; 579 virtual QString name() const;
555 580
581 private:
582 class Private;
583 Private *d;
556}; 584};
557 585
586}
587}
588
558#endif // ONETWORK_H 589#endif // ONETWORK_H
559 590
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index fdd519c..4081d4f 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -42,12 +42,17 @@
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;
49
50namespace Opie {
51namespace Net {
52
48/*====================================================================================== 53/*======================================================================================
49 * OPacket 54 * OPacket
50 *======================================================================================*/ 55 *======================================================================================*/
51 56
52OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) 57OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent )
53 :QObject( parent, "Generic" ), _hdr( header ), _data( data ) 58 :QObject( parent, "Generic" ), _hdr( header ), _data( data )
@@ -1341,7 +1346,8 @@ bool OPacketCapturer::swapped() const
1341 1346
1342QString OPacketCapturer::version() const 1347QString OPacketCapturer::version() const
1343{ 1348{
1344 return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) ); 1349 return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) );
1345} 1350}
1346 1351
1347 1352}
1353}
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index b873b49..dc609a3 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -61,14 +61,16 @@ extern "C" // work around a bpf/pcap conflict in recent headers
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 OPacketCapturer;
68class QSocketNotifier; 67class QSocketNotifier;
68namespace Opie {
69namespace Net {
70class OPacketCapturer;
69 71
70/*====================================================================================== 72/*======================================================================================
71 * OPacket - A frame on the wire 73 * OPacket - A frame on the wire
72 *======================================================================================*/ 74 *======================================================================================*/
73 75
74/** @brief A class representing a data frame on the wire. 76/** @brief A class representing a data frame on the wire.
@@ -138,12 +140,15 @@ class OPacket : public QObject
138 QString _dumpStructure( QObjectList* ) const; 140 QString _dumpStructure( QObjectList* ) const;
139 141
140 private: 142 private:
141 const packetheaderstruct _hdr; // pcap packet header 143 const packetheaderstruct _hdr; // pcap packet header
142 const unsigned char* _data; // pcap packet data 144 const unsigned char* _data; // pcap packet data
143 const unsigned char* _end; // end of pcap packet data 145 const unsigned char* _end; // end of pcap packet data
146 private:
147 class Private;
148 Private *d;
144}; 149};
145 150
146QTextStream& operator<<( QTextStream& s, const OPacket& p ); 151QTextStream& operator<<( QTextStream& s, const OPacket& p );
147 152
148/*====================================================================================== 153/*======================================================================================
149 * OEthernetPacket - DLT_EN10MB frame 154 * OEthernetPacket - DLT_EN10MB frame
@@ -160,12 +165,15 @@ class OEthernetPacket : public QObject
160 OMacAddress sourceAddress() const; 165 OMacAddress sourceAddress() const;
161 OMacAddress destinationAddress() const; 166 OMacAddress destinationAddress() const;
162 int type() const; 167 int type() const;
163 168
164 private: 169 private:
165 const struct ether_header* _ether; 170 const struct ether_header* _ether;
171 private:
172 class Private;
173 Private *d;
166}; 174};
167 175
168/*====================================================================================== 176/*======================================================================================
169 * OPrismHeaderPacket - DLT_PRISM_HEADER frame 177 * OPrismHeaderPacket - DLT_PRISM_HEADER frame
170 *======================================================================================*/ 178 *======================================================================================*/
171 179
@@ -178,12 +186,14 @@ class OPrismHeaderPacket : public QObject
178 virtual ~OPrismHeaderPacket(); 186 virtual ~OPrismHeaderPacket();
179 187
180 unsigned int signalStrength() const; 188 unsigned int signalStrength() const;
181 189
182 private: 190 private:
183 const struct prism_hdr* _header; 191 const struct prism_hdr* _header;
192 class Private;
193 Private *d;
184}; 194};
185 195
186/*====================================================================================== 196/*======================================================================================
187 * OWaveLanPacket - DLT_IEEE802_11 frame 197 * OWaveLanPacket - DLT_IEEE802_11 frame
188 *======================================================================================*/ 198 *======================================================================================*/
189 199
@@ -207,12 +217,14 @@ class OWaveLanPacket : public QObject
207 int subType() const; 217 int subType() const;
208 int version() const; 218 int version() const;
209 bool usesWep() const; 219 bool usesWep() const;
210 220
211 private: 221 private:
212 const struct ieee_802_11_header* _wlanhdr; 222 const struct ieee_802_11_header* _wlanhdr;
223 class Private;
224 Private *d;
213}; 225};
214 226
215 227
216/*====================================================================================== 228/*======================================================================================
217 * OWaveLanManagementPacket - type: management (T_MGMT) 229 * OWaveLanManagementPacket - type: management (T_MGMT)
218 *======================================================================================*/ 230 *======================================================================================*/
@@ -236,12 +248,14 @@ class OWaveLanManagementPacket : public QObject
236 bool canCFP_REQ() const; 248 bool canCFP_REQ() const;
237 bool canPrivacy() const; 249 bool canPrivacy() const;
238 250
239 private: 251 private:
240 const struct ieee_802_11_mgmt_header* _header; 252 const struct ieee_802_11_mgmt_header* _header;
241 const struct ieee_802_11_mgmt_body* _body; 253 const struct ieee_802_11_mgmt_body* _body;
254 class Private;
255 Private *d;
242}; 256};
243 257
244 258
245/*====================================================================================== 259/*======================================================================================
246 * OWaveLanManagementSSID 260 * OWaveLanManagementSSID
247 *======================================================================================*/ 261 *======================================================================================*/
@@ -255,12 +269,14 @@ class OWaveLanManagementSSID : public QObject
255 virtual ~OWaveLanManagementSSID(); 269 virtual ~OWaveLanManagementSSID();
256 270
257 QString ID( bool decloak = false ) const; 271 QString ID( bool decloak = false ) const;
258 272
259 private: 273 private:
260 const struct ssid_t* _data; 274 const struct ssid_t* _data;
275 class Private;
276 Private *d;
261}; 277};
262 278
263/*====================================================================================== 279/*======================================================================================
264 * OWaveLanManagementRates 280 * OWaveLanManagementRates
265 *======================================================================================*/ 281 *======================================================================================*/
266 282
@@ -271,12 +287,14 @@ class OWaveLanManagementRates : public QObject
271 public: 287 public:
272 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); 288 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 );
273 virtual ~OWaveLanManagementRates(); 289 virtual ~OWaveLanManagementRates();
274 290
275 private: 291 private:
276 const struct rates_t* _data; 292 const struct rates_t* _data;
293 class Private;
294 Private *d;
277}; 295};
278 296
279/*====================================================================================== 297/*======================================================================================
280 * OWaveLanManagementCF 298 * OWaveLanManagementCF
281 *======================================================================================*/ 299 *======================================================================================*/
282 300
@@ -287,12 +305,14 @@ class OWaveLanManagementCF : public QObject
287 public: 305 public:
288 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); 306 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 );
289 virtual ~OWaveLanManagementCF(); 307 virtual ~OWaveLanManagementCF();
290 308
291 private: 309 private:
292 const struct cf_t* _data; 310 const struct cf_t* _data;
311 class Private;
312 Private *d;
293}; 313};
294 314
295/*====================================================================================== 315/*======================================================================================
296 * OWaveLanManagementFH 316 * OWaveLanManagementFH
297 *======================================================================================*/ 317 *======================================================================================*/
298 318
@@ -303,12 +323,14 @@ class OWaveLanManagementFH : public QObject
303 public: 323 public:
304 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); 324 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 );
305 virtual ~OWaveLanManagementFH(); 325 virtual ~OWaveLanManagementFH();
306 326
307 private: 327 private:
308 const struct fh_t* _data; 328 const struct fh_t* _data;
329 class Private;
330 Private *d;
309}; 331};
310 332
311/*====================================================================================== 333/*======================================================================================
312 * OWaveLanManagementDS 334 * OWaveLanManagementDS
313 *======================================================================================*/ 335 *======================================================================================*/
314 336
@@ -321,12 +343,14 @@ class OWaveLanManagementDS : public QObject
321 virtual ~OWaveLanManagementDS(); 343 virtual ~OWaveLanManagementDS();
322 344
323 int channel() const; 345 int channel() const;
324 346
325 private: 347 private:
326 const struct ds_t* _data; 348 const struct ds_t* _data;
349 class Private;
350 Private *d;
327}; 351};
328 352
329/*====================================================================================== 353/*======================================================================================
330 * OWaveLanManagementTim 354 * OWaveLanManagementTim
331 *======================================================================================*/ 355 *======================================================================================*/
332 356
@@ -337,12 +361,14 @@ class OWaveLanManagementTim : public QObject
337 public: 361 public:
338 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); 362 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 );
339 virtual ~OWaveLanManagementTim(); 363 virtual ~OWaveLanManagementTim();
340 364
341 private: 365 private:
342 const struct tim_t* _data; 366 const struct tim_t* _data;
367 class Private;
368 Private *d;
343}; 369};
344 370
345/*====================================================================================== 371/*======================================================================================
346 * OWaveLanManagementIBSS 372 * OWaveLanManagementIBSS
347 *======================================================================================*/ 373 *======================================================================================*/
348 374
@@ -353,12 +379,14 @@ class OWaveLanManagementIBSS : public QObject
353 public: 379 public:
354 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); 380 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 );
355 virtual ~OWaveLanManagementIBSS(); 381 virtual ~OWaveLanManagementIBSS();
356 382
357 private: 383 private:
358 const struct ibss_t* _data; 384 const struct ibss_t* _data;
385 class Private;
386 Private *d;
359}; 387};
360 388
361/*====================================================================================== 389/*======================================================================================
362 * OWaveLanManagementChallenge 390 * OWaveLanManagementChallenge
363 *======================================================================================*/ 391 *======================================================================================*/
364 392
@@ -369,12 +397,14 @@ class OWaveLanManagementChallenge : public QObject
369 public: 397 public:
370 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); 398 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 );
371 virtual ~OWaveLanManagementChallenge(); 399 virtual ~OWaveLanManagementChallenge();
372 400
373 private: 401 private:
374 const struct challenge_t* _data; 402 const struct challenge_t* _data;
403 class Private;
404 Private *d;
375}; 405};
376 406
377/*====================================================================================== 407/*======================================================================================
378 * OWaveLanDataPacket - type: data (T_DATA) 408 * OWaveLanDataPacket - type: data (T_DATA)
379 *======================================================================================*/ 409 *======================================================================================*/
380 410
@@ -385,12 +415,14 @@ class OWaveLanDataPacket : public QObject
385 public: 415 public:
386 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); 416 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 );
387 virtual ~OWaveLanDataPacket(); 417 virtual ~OWaveLanDataPacket();
388 418
389 private: 419 private:
390 const struct ieee_802_11_data_header* _header; 420 const struct ieee_802_11_data_header* _header;
421 class Private;
422 Private *d;
391}; 423};
392 424
393/*====================================================================================== 425/*======================================================================================
394 * OWaveLanControlPacket - type: control (T_CTRL) 426 * OWaveLanControlPacket - type: control (T_CTRL)
395 *======================================================================================*/ 427 *======================================================================================*/
396 428
@@ -403,12 +435,14 @@ class OWaveLanControlPacket : public QObject
403 virtual ~OWaveLanControlPacket(); 435 virtual ~OWaveLanControlPacket();
404 436
405 QString controlType() const; 437 QString controlType() const;
406 438
407 private: 439 private:
408 const struct ieee_802_11_control_header* _header; 440 const struct ieee_802_11_control_header* _header;
441 class Private;
442 Private *d;
409}; 443};
410 444
411/*====================================================================================== 445/*======================================================================================
412 * OLLCPacket - IEEE 802.2 Link Level Control 446 * OLLCPacket - IEEE 802.2 Link Level Control
413 *======================================================================================*/ 447 *======================================================================================*/
414 448
@@ -419,12 +453,14 @@ class OLLCPacket : public QObject
419 public: 453 public:
420 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); 454 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 );
421 virtual ~OLLCPacket(); 455 virtual ~OLLCPacket();
422 456
423 private: 457 private:
424 const struct ieee_802_11_802_2_header* _header; 458 const struct ieee_802_11_802_2_header* _header;
459 class Private;
460 Private *d;
425}; 461};
426 462
427/*====================================================================================== 463/*======================================================================================
428 * OIPPacket 464 * OIPPacket
429 *======================================================================================*/ 465 *======================================================================================*/
430 466
@@ -446,12 +482,14 @@ class OIPPacket : public QObject
446 int ttl() const; 482 int ttl() const;
447 int protocol() const; 483 int protocol() const;
448 int checksum() const; 484 int checksum() const;
449 485
450 private: 486 private:
451 const struct iphdr* _iphdr; 487 const struct iphdr* _iphdr;
488 class Private;
489 Private *d;
452}; 490};
453 491
454/*====================================================================================== 492/*======================================================================================
455 * OARPPacket 493 * OARPPacket
456 *======================================================================================*/ 494 *======================================================================================*/
457 495
@@ -470,12 +508,14 @@ class OARPPacket : public QObject
470 508
471 //int type() const; 509 //int type() const;
472 QString type() const; 510 QString type() const;
473 511
474 private: 512 private:
475 const struct myarphdr* _arphdr; 513 const struct myarphdr* _arphdr;
514 class Private;
515 Private *d;
476}; 516};
477 517
478/*====================================================================================== 518/*======================================================================================
479 * OUDPPacket 519 * OUDPPacket
480 *======================================================================================*/ 520 *======================================================================================*/
481 521
@@ -491,12 +531,14 @@ class OUDPPacket : public QObject
491 int toPort() const; 531 int toPort() const;
492 int length() const; 532 int length() const;
493 int checksum() const; 533 int checksum() const;
494 534
495 private: 535 private:
496 const struct udphdr* _udphdr; 536 const struct udphdr* _udphdr;
537 class Private;
538 Private *d;
497}; 539};
498 540
499/*====================================================================================== 541/*======================================================================================
500 * ODHCPPacket 542 * ODHCPPacket
501 *======================================================================================*/ 543 *======================================================================================*/
502 544
@@ -519,12 +561,14 @@ class ODHCPPacket : public QObject
519 bool isReply() const; 561 bool isReply() const;
520 QString type() const; 562 QString type() const;
521 563
522 private: 564 private:
523 const struct dhcp_packet* _dhcphdr; 565 const struct dhcp_packet* _dhcphdr;
524 unsigned char _type; 566 unsigned char _type;
567 class Private;
568 Private *d;
525}; 569};
526 570
527/*====================================================================================== 571/*======================================================================================
528 * OTCPPacket 572 * OTCPPacket
529 *======================================================================================*/ 573 *======================================================================================*/
530 574
@@ -542,12 +586,14 @@ class OTCPPacket : public QObject
542 int ack() const; 586 int ack() const;
543 int window() const; 587 int window() const;
544 int checksum() const; 588 int checksum() const;
545 589
546 private: 590 private:
547 const struct tcphdr* _tcphdr; 591 const struct tcphdr* _tcphdr;
592 class Private;
593 Private *d;
548}; 594};
549 595
550 596
551/*====================================================================================== 597/*======================================================================================
552 * OPacketCapturer 598 * OPacketCapturer
553 *======================================================================================*/ 599 *======================================================================================*/
@@ -662,10 +708,14 @@ class OPacketCapturer : public QObject
662 bool _open; // check this before doing pcap calls 708 bool _open; // check this before doing pcap calls
663 pcap_t* _pch; // pcap library handle 709 pcap_t* _pch; // pcap library handle
664 pcap_dumper_t* _pcd; // pcap dumper handle 710 pcap_dumper_t* _pcd; // pcap dumper handle
665 QSocketNotifier* _sn; // socket notifier for main loop 711 QSocketNotifier* _sn; // socket notifier for main loop
666 mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap 712 mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap
667 QMap<QString, int> _stats; // statistics; 713 QMap<QString, int> _stats; // statistics;
714 class Private; // Private Forward declaration
715 Private *d; // if we need to add data
668}; 716};
717}
718}
669 719
670#endif // OPCAP_H 720#endif // OPCAP_H
671 721
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp
index 8c989d8..140b924 100644
--- a/libopie2/opienet/ostation.cpp
+++ b/libopie2/opienet/ostation.cpp
@@ -28,12 +28,17 @@
28 28
29*/ 29*/
30 30
31#include <opie2/ostation.h> 31#include <opie2/ostation.h>
32#include <opie2/odebug.h> 32#include <opie2/odebug.h>
33 33
34
35using namespace Opie::Core;
36
37namespace Opie {
38namespace Net {
34/*====================================================================================== 39/*======================================================================================
35 * OStation 40 * OStation
36 *======================================================================================*/ 41 *======================================================================================*/
37 42
38OStation::OStation() 43OStation::OStation()
39{ 44{
@@ -59,6 +64,9 @@ void OStation::dump()
59 odebug << "------- OStation::dump() ------------" << oendl; 64 odebug << "------- OStation::dump() ------------" << oendl;
60 qDebug( "type: %s", (const char*) type ); 65 qDebug( "type: %s", (const char*) type );
61 qDebug( "mac: %s", (const char*) macAddress.toString() ); 66 qDebug( "mac: %s", (const char*) macAddress.toString() );
62 qDebug( "ap: %s", (const char*) apAddress.toString() ); 67 qDebug( "ap: %s", (const char*) apAddress.toString() );
63 qDebug( "ip: %s", (const char*) ipAddress.toString() ); 68 qDebug( "ip: %s", (const char*) ipAddress.toString() );
64} 69}
70
71}
72} \ No newline at end of file
diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h
index 1e7366d..68f1114 100644
--- a/libopie2/opienet/ostation.h
+++ b/libopie2/opienet/ostation.h
@@ -37,14 +37,18 @@
37#include <qstring.h> 37#include <qstring.h>
38#include <qhostaddress.h> 38#include <qhostaddress.h>
39#include <qobject.h> 39#include <qobject.h>
40 40
41#include <sys/types.h> 41#include <sys/types.h>
42 42
43namespace Opie {
44namespace Net {
45
43class OStation; 46class OStation;
44 47
48
45typedef QList<OStation> OStationList; 49typedef QList<OStation> OStationList;
46 50
47/*====================================================================================== 51/*======================================================================================
48 * OStation 52 * OStation
49 *======================================================================================*/ 53 *======================================================================================*/
50 54
@@ -63,11 +67,16 @@ class OStation
63 67
64 /* WaveLan */ 68 /* WaveLan */
65 QString ssid; 69 QString ssid;
66 OMacAddress apAddress; 70 OMacAddress apAddress;
67 int channel; 71 int channel;
68 bool encrypted; 72 bool encrypted;
73 private:
74 class Private;
75 Private *d;
69}; 76};
70 77
78}
79}
71 80
72#endif // OSTATION_H 81#endif // OSTATION_H
73 82