author | zecke <zecke> | 2004-03-13 19:51:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-13 19:51:45 (UTC) |
commit | 6d08277737e22b7a1527124623f3571969073ddf (patch) (unidiff) | |
tree | 4129e674e21df767b31299e873dd44e33a308e1b /libopie2/opienet | |
parent | 8e28911f7199f4450ac5eef09482069f9b9caea2 (diff) | |
download | opie-6d08277737e22b7a1527124623f3571969073ddf.zip opie-6d08277737e22b7a1527124623f3571969073ddf.tar.gz opie-6d08277737e22b7a1527124623f3571969073ddf.tar.bz2 |
Move XML class to internal PIM
Add namespaces!!!
Opie::Core and Opie::Core::Private
Opie::Net and Opie::Net::Private
Opie::Ui and Opie::Ui::Private
Opie::MM and Opie::MM::Private
Opie::DB and Opie::DB::Private
PIM classes are not yet converted because we will do other work
on it as well
-rw-r--r-- | libopie2/opienet/802_11_user.h | 1 | ||||
-rw-r--r-- | libopie2/opienet/dhcp.h | 2 | ||||
-rw-r--r-- | libopie2/opienet/odebugmapper.cpp | 10 | ||||
-rw-r--r-- | libopie2/opienet/odebugmapper.h | 10 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 7 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.h | 8 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 9 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 15 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 9 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 31 | ||||
-rw-r--r-- | libopie2/opienet/opcap.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 52 | ||||
-rw-r--r-- | libopie2/opienet/ostation.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/ostation.h | 9 |
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 | |||
@@ -446,13 +446,14 @@ struct ctrl_end_ack_t { | |||
446 | u_int16_tduration; | 446 | u_int16_tduration; |
447 | u_int8_tra[6]; | 447 | u_int8_tra[6]; |
448 | u_int8_tbssid[6]; | 448 | u_int8_tbssid[6]; |
449 | u_int8_tfcs[4]; | 449 | u_int8_tfcs[4]; |
450 | }; | 450 | }; |
451 | 451 | ||
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 | |||
@@ -33,24 +33,25 @@ | |||
33 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. |
35 | * | 35 | * |
36 | * This software has been written for the Internet Software Consortium | 36 | * This software has been written for the Internet Software Consortium |
37 | * by Ted Lemon in cooperation with Vixie Enterprises. To learn more | 37 | * by Ted Lemon in cooperation with Vixie Enterprises. To learn more |
38 | * about the Internet Software Consortium, see ``http://www.isc.org''. | 38 | * about the Internet Software Consortium, see ``http://www.isc.org''. |
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 |
51 | #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) | 52 | #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) |
52 | /* Everything but options. */ | 53 | /* Everything but options. */ |
53 | #define DHCP_MTU_MAX 1500 | 54 | #define DHCP_MTU_MAX 1500 |
54 | #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) | 55 | #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) |
55 | 56 | ||
56 | #define BOOTP_MIN_LEN 300 | 57 | #define BOOTP_MIN_LEN 300 |
@@ -188,14 +189,15 @@ struct dhcp_packet { | |||
188 | 189 | ||
189 | /* FQDN suboptions: */ | 190 | /* FQDN suboptions: */ |
190 | #define FQDN_NO_CLIENT_UPDATE 1 | 191 | #define FQDN_NO_CLIENT_UPDATE 1 |
191 | #define FQDN_SERVER_UPDATE 2 | 192 | #define FQDN_SERVER_UPDATE 2 |
192 | #define FQDN_ENCODED 3 | 193 | #define FQDN_ENCODED 3 |
193 | #define FQDN_RCODE1 4 | 194 | #define FQDN_RCODE1 4 |
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 | |||
@@ -1,21 +1,27 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
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 | ||
10 | using namespace Opie::Core; | ||
11 | |||
12 | namespace Opie { | ||
13 | namespace Net { | ||
14 | namespace Private { | ||
15 | |||
10 | DebugMapper::DebugMapper() | 16 | DebugMapper::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") ); |
16 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); | 22 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); |
17 | _map.insert( 0x8905, new QString("SIOCATMARK") ); | 23 | _map.insert( 0x8905, new QString("SIOCATMARK") ); |
18 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); | 24 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); |
19 | _map.insert( 0x890B, new QString("SIOCADDRT") ); | 25 | _map.insert( 0x890B, new QString("SIOCADDRT") ); |
20 | _map.insert( 0x890C, new QString("SIOCDELRT") ); | 26 | _map.insert( 0x890C, new QString("SIOCDELRT") ); |
21 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); | 27 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); |
@@ -203,13 +209,15 @@ const QString& DebugMapper::map( int value ) const | |||
203 | 209 | ||
204 | if ( !result ) | 210 | if ( !result ) |
205 | { | 211 | { |
206 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; | 212 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; |
207 | return QString::null; | 213 | return QString::null; |
208 | } | 214 | } |
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 | |||
@@ -1,26 +1,36 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
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 | ||
12 | namespace Opie { | ||
13 | namespace Net { | ||
14 | namespace Private { | ||
15 | |||
12 | typedef QIntDict<QString> IntStringMap; | 16 | typedef QIntDict<QString> IntStringMap; |
13 | 17 | ||
14 | class DebugMapper | 18 | class 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 | |||
@@ -34,24 +34,28 @@ | |||
34 | 34 | ||
35 | /* OPIE */ | 35 | /* OPIE */ |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 37 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #endif | 39 | #endif |
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 | ||
46 | using namespace Opie::Core; | ||
47 | namespace Opie { | ||
48 | namespace Net { | ||
49 | |||
46 | OManufacturerDB* OManufacturerDB::_instance = 0; | 50 | OManufacturerDB* OManufacturerDB::_instance = 0; |
47 | 51 | ||
48 | OManufacturerDB* OManufacturerDB::instance() | 52 | OManufacturerDB* OManufacturerDB::instance() |
49 | { | 53 | { |
50 | if ( !OManufacturerDB::_instance ) | 54 | if ( !OManufacturerDB::_instance ) |
51 | { | 55 | { |
52 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 56 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
53 | _instance = new OManufacturerDB(); | 57 | _instance = new OManufacturerDB(); |
54 | } | 58 | } |
55 | return _instance; | 59 | return _instance; |
56 | } | 60 | } |
57 | 61 | ||
@@ -124,12 +128,15 @@ OManufacturerDB::~OManufacturerDB() | |||
124 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 128 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
125 | { | 129 | { |
126 | return manufacturers[macaddr.upper().left(8)]; | 130 | return manufacturers[macaddr.upper().left(8)]; |
127 | } | 131 | } |
128 | 132 | ||
129 | 133 | ||
130 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 134 | const 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 | |||
@@ -24,24 +24,27 @@ | |||
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 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 | ||
36 | namespace Opie { | ||
37 | namespace 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 | */ |
42 | class OManufacturerDB | 45 | class OManufacturerDB |
43 | { | 46 | { |
44 | public: | 47 | public: |
45 | /** | 48 | /** |
46 | * @returns the one-and-only @ref OManufacturerDB instance. | 49 | * @returns the one-and-only @ref OManufacturerDB instance. |
47 | */ | 50 | */ |
@@ -54,16 +57,21 @@ class OManufacturerDB | |||
54 | * @returns the enhanced manufacturer string given a @a macaddr. | 57 | * @returns the enhanced manufacturer string given a @a macaddr. |
55 | */ | 58 | */ |
56 | const QString& lookupExt( const QString& macaddr ) const; | 59 | const QString& lookupExt( const QString& macaddr ) const; |
57 | 60 | ||
58 | protected: | 61 | protected: |
59 | OManufacturerDB(); | 62 | 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 | |||
@@ -28,24 +28,27 @@ | |||
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/onetutils.h> | 32 | #include <opie2/onetutils.h> |
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
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 | ||
40 | namespace Opie { | ||
41 | namespace 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 |
45 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 48 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
46 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); | 49 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); |
47 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; | 50 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; |
48 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); | 51 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); |
49 | 52 | ||
50 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) | 53 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) |
51 | 54 | ||
@@ -176,24 +179,27 @@ int OPrivateIOCTL::typeSetArgs() const | |||
176 | void OPrivateIOCTL::invoke() const | 179 | void OPrivateIOCTL::invoke() const |
177 | { | 180 | { |
178 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | 181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); |
179 | } | 182 | } |
180 | 183 | ||
181 | 184 | ||
182 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) | 185 | void 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 | |||
193 | namespace Private { | ||
188 | /*====================================================================================== | 194 | /*====================================================================================== |
189 | * assorted functions | 195 | * assorted functions |
190 | *======================================================================================*/ | 196 | *======================================================================================*/ |
191 | 197 | ||
192 | void dumpBytes( const unsigned char* data, int num ) | 198 | void dumpBytes( const unsigned char* data, int num ) |
193 | { | 199 | { |
194 | printf( "Dumping %d bytes @ %0x", num, data ); | 200 | printf( "Dumping %d bytes @ %0x", num, data ); |
195 | printf( "-------------------------------------------\n" ); | 201 | printf( "-------------------------------------------\n" ); |
196 | 202 | ||
197 | for ( int i = 0; i < num; ++i ) | 203 | for ( int i = 0; i < num; ++i ) |
198 | { | 204 | { |
199 | printf( "%02x ", data[i] ); | 205 | printf( "%02x ", data[i] ); |
@@ -221,12 +227,15 @@ QString modeToString( int mode ) | |||
221 | switch ( mode ) | 227 | switch ( mode ) |
222 | { | 228 | { |
223 | case IW_MODE_AUTO: return "auto"; | 229 | case IW_MODE_AUTO: return "auto"; |
224 | case IW_MODE_ADHOC: return "adhoc"; | 230 | case IW_MODE_ADHOC: return "adhoc"; |
225 | case IW_MODE_INFRA: return "managed"; | 231 | case IW_MODE_INFRA: return "managed"; |
226 | case IW_MODE_MASTER: return "master"; | 232 | case IW_MODE_MASTER: return "master"; |
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 | |||
@@ -32,24 +32,28 @@ | |||
32 | #ifndef ONETUTILS_H | 32 | #ifndef ONETUTILS_H |
33 | #define ONETUTILS_H | 33 | #define ONETUTILS_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <qdict.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
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 | ||
43 | struct ifreq; | 43 | struct ifreq; |
44 | |||
45 | namespace Opie { | ||
46 | namespace Net { | ||
47 | |||
44 | class OWirelessNetworkInterface; | 48 | class OWirelessNetworkInterface; |
45 | 49 | ||
46 | /*====================================================================================== | 50 | /*====================================================================================== |
47 | * OMacAddress | 51 | * OMacAddress |
48 | *======================================================================================*/ | 52 | *======================================================================================*/ |
49 | 53 | ||
50 | class OMacAddress | 54 | class OMacAddress |
51 | { | 55 | { |
52 | public: | 56 | public: |
53 | // QString c'tor? -zecke | 57 | // QString c'tor? -zecke |
54 | OMacAddress(); | 58 | OMacAddress(); |
55 | OMacAddress( unsigned char* ); | 59 | OMacAddress( unsigned char* ); |
@@ -63,40 +67,45 @@ class OMacAddress | |||
63 | 67 | ||
64 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? | 68 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? |
65 | static OMacAddress fromString( const QString& ); | 69 | static OMacAddress fromString( const QString& ); |
66 | 70 | ||
67 | public: | 71 | public: |
68 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
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 | ||
78 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | 85 | ||
80 | 86 | ||
81 | /*====================================================================================== | 87 | /*====================================================================================== |
82 | * OHostAddress | 88 | * OHostAddress |
83 | *======================================================================================*/ | 89 | *======================================================================================*/ |
84 | 90 | ||
85 | class OHostAddress : public QHostAddress | 91 | class 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 | *======================================================================================*/ |
97 | 106 | ||
98 | class OPrivateIOCTL : public QObject | 107 | class OPrivateIOCTL : public QObject |
99 | { | 108 | { |
100 | public: | 109 | public: |
101 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); | 110 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); |
102 | ~OPrivateIOCTL(); | 111 | ~OPrivateIOCTL(); |
@@ -106,33 +115,39 @@ class OPrivateIOCTL : public QObject | |||
106 | int numberSetArgs() const; | 115 | int numberSetArgs() const; |
107 | int typeSetArgs() const; | 116 | int typeSetArgs() const; |
108 | 117 | ||
109 | // FIXME return int? as ::ioctl does? -zecke | 118 | // FIXME return int? as ::ioctl does? -zecke |
110 | void invoke() const; | 119 | void invoke() const; |
111 | void setParameter( int, u_int32_t ); | 120 | void setParameter( int, u_int32_t ); |
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 | ||
135 | namespace Private { | ||
124 | void dumpBytes( const unsigned char* data, int num ); | 136 | void dumpBytes( const unsigned char* data, int num ); |
125 | QString modeToString( int ); | 137 | QString modeToString( int ); |
126 | int stringToMode( const QString& ); | 138 | int 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 |
133 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 148 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
134 | #define IW_PRIV_TYPE_ADDR 0x6000 | 149 | #define IW_PRIV_TYPE_ADDR 0x6000 |
135 | #define IW_PRIV_SIZE_FIXED 0x0800 | 150 | #define IW_PRIV_SIZE_FIXED 0x0800 |
136 | #define IW_PRIV_SIZE_MASK 0x07FF | 151 | #define IW_PRIV_SIZE_MASK 0x07FF |
137 | 152 | ||
138 | #ifndef ARPHRD_IEEE80211 | 153 | #ifndef ARPHRD_IEEE80211 |
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 | |||
@@ -48,31 +48,37 @@ | |||
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> |
52 | #include <sys/types.h> | 52 | #include <sys/types.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
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 | |||
62 | using namespace Opie::Core; | ||
63 | using namespace Opie::Net::Private; | ||
60 | DebugMapper* debugmapper = new DebugMapper(); | 64 | DebugMapper* debugmapper = new DebugMapper(); |
61 | #endif | 65 | #endif |
62 | 66 | ||
63 | /*====================================================================================== | 67 | /*====================================================================================== |
64 | * ONetwork | 68 | * ONetwork |
65 | *======================================================================================*/ | 69 | *======================================================================================*/ |
66 | 70 | ||
71 | namespace Opie { | ||
72 | namespace Net { | ||
67 | ONetwork* ONetwork::_instance = 0; | 73 | ONetwork* ONetwork::_instance = 0; |
68 | 74 | ||
69 | ONetwork::ONetwork() | 75 | ONetwork::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; |
73 | synchronize(); | 79 | synchronize(); |
74 | } | 80 | } |
75 | 81 | ||
76 | void ONetwork::synchronize() | 82 | void ONetwork::synchronize() |
77 | { | 83 | { |
78 | // gather available interfaces by inspecting /proc/net/dev | 84 | // gather available interfaces by inspecting /proc/net/dev |
@@ -1228,12 +1234,15 @@ void OOrinocoMonitoringInterface::setEnabled( bool b ) | |||
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | _if->setPrivate( "monitor", 2, 0, 0 ); | 1237 | _if->setPrivate( "monitor", 2, 0, 0 ); |
1232 | } | 1238 | } |
1233 | } | 1239 | } |
1234 | 1240 | ||
1235 | 1241 | ||
1236 | QString OOrinocoMonitoringInterface::name() const | 1242 | QString 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 | |||
@@ -47,24 +47,27 @@ | |||
47 | 47 | ||
48 | #include <opie2/onetutils.h> | 48 | #include <opie2/onetutils.h> |
49 | #include <opie2/ostation.h> | 49 | #include <opie2/ostation.h> |
50 | 50 | ||
51 | /* QT */ | 51 | /* QT */ |
52 | 52 | ||
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 | ||
59 | namespace Opie { | ||
60 | namespace Net { | ||
61 | |||
59 | class ONetworkInterface; | 62 | class ONetworkInterface; |
60 | class OWirelessNetworkInterface; | 63 | class OWirelessNetworkInterface; |
61 | class OChannelHopper; | 64 | class OChannelHopper; |
62 | class OMonitoringInterface; | 65 | class OMonitoringInterface; |
63 | 66 | ||
64 | /*====================================================================================== | 67 | /*====================================================================================== |
65 | * ONetwork | 68 | * ONetwork |
66 | *======================================================================================*/ | 69 | *======================================================================================*/ |
67 | 70 | ||
68 | /** | 71 | /** |
69 | * @brief A container class for all network interfaces | 72 | * @brief A container class for all network interfaces |
70 | * | 73 | * |
@@ -114,24 +117,26 @@ class ONetwork : public QObject | |||
114 | void synchronize(); | 117 | void synchronize(); |
115 | /** | 118 | /** |
116 | * @returns the wireless extension version used at compile time. | 119 | * @returns the wireless extension version used at compile time. |
117 | **/ | 120 | **/ |
118 | static short wirelessExtensionVersion(); | 121 | static short wirelessExtensionVersion(); |
119 | 122 | ||
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 | *======================================================================================*/ |
132 | 137 | ||
133 | /** | 138 | /** |
134 | * @brief A network interface wrapper. | 139 | * @brief A network interface wrapper. |
135 | * | 140 | * |
136 | * This class provides a wrapper for a network interface. All the cumbersume details of | 141 | * This class provides a wrapper for a network interface. All the cumbersume details of |
137 | * Linux ioctls are hidden under a convenient high-level interface. | 142 | * Linux ioctls are hidden under a convenient high-level interface. |
@@ -225,24 +230,27 @@ class ONetworkInterface : public QObject | |||
225 | int dataLinkType() const; | 230 | int dataLinkType() const; |
226 | 231 | ||
227 | protected: | 232 | protected: |
228 | const int _sfd; | 233 | const int _sfd; |
229 | mutable ifreq _ifr; | 234 | mutable ifreq _ifr; |
230 | OMonitoringInterface* _mon; | 235 | OMonitoringInterface* _mon; |
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 | ||
243 | /** | 251 | /** |
244 | * @brief A radio frequency channel hopper. | 252 | * @brief A radio frequency channel hopper. |
245 | * | 253 | * |
246 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 254 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
247 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 255 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
248 | * This is necessary when in monitoring mode and scanning for other devices, because | 256 | * This is necessary when in monitoring mode and scanning for other devices, because |
@@ -287,24 +295,26 @@ class OChannelHopper : public QObject | |||
287 | */ | 295 | */ |
288 | void hopped( int ); | 296 | void hopped( int ); |
289 | 297 | ||
290 | protected: | 298 | protected: |
291 | virtual void timerEvent( QTimerEvent* ); | 299 | virtual void timerEvent( QTimerEvent* ); |
292 | 300 | ||
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 | *======================================================================================*/ |
305 | 315 | ||
306 | /** | 316 | /** |
307 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 317 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
308 | * | 318 | * |
309 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 319 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
310 | * | 320 | * |
@@ -446,114 +456,135 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
446 | virtual void init(); | 456 | virtual void init(); |
447 | struct iwreq& iwr() const; | 457 | struct iwreq& iwr() const; |
448 | bool wioctl( int call ) const; | 458 | bool wioctl( int call ) const; |
449 | bool wioctl( int call, struct iwreq& ) const; | 459 | bool wioctl( int call, struct iwreq& ) const; |
450 | 460 | ||
451 | protected: | 461 | protected: |
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 | *======================================================================================*/ |
464 | 476 | ||
465 | 477 | ||
466 | class OMonitoringInterface | 478 | class OMonitoringInterface |
467 | { | 479 | { |
468 | public: | 480 | public: |
469 | OMonitoringInterface(); | 481 | OMonitoringInterface(); |
470 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 482 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
471 | virtual ~OMonitoringInterface(); | 483 | virtual ~OMonitoringInterface(); |
472 | 484 | ||
473 | public: | 485 | public: |
474 | virtual void setEnabled( bool ); | 486 | virtual void setEnabled( bool ); |
475 | virtual void setChannel( int ); | 487 | virtual void setChannel( int ); |
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 |
488 | *======================================================================================*/ | 503 | *======================================================================================*/ |
489 | 504 | ||
490 | 505 | ||
491 | class OCiscoMonitoringInterface : public OMonitoringInterface | 506 | class OCiscoMonitoringInterface : public OMonitoringInterface |
492 | { | 507 | { |
493 | public: | 508 | public: |
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 |
506 | *======================================================================================*/ | 524 | *======================================================================================*/ |
507 | 525 | ||
508 | 526 | ||
509 | class OWlanNGMonitoringInterface : public OMonitoringInterface | 527 | class OWlanNGMonitoringInterface : public OMonitoringInterface |
510 | { | 528 | { |
511 | public: | 529 | public: |
512 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 530 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
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 |
525 | *======================================================================================*/ | 546 | *======================================================================================*/ |
526 | 547 | ||
527 | 548 | ||
528 | class OHostAPMonitoringInterface : public OMonitoringInterface | 549 | class OHostAPMonitoringInterface : public OMonitoringInterface |
529 | { | 550 | { |
530 | public: | 551 | public: |
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 | *======================================================================================*/ |
543 | 568 | ||
544 | 569 | ||
545 | class OOrinocoMonitoringInterface : public OMonitoringInterface | 570 | class OOrinocoMonitoringInterface : public OMonitoringInterface |
546 | { | 571 | { |
547 | public: | 572 | public: |
548 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 573 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
549 | virtual ~OOrinocoMonitoringInterface(); | 574 | virtual ~OOrinocoMonitoringInterface(); |
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 | |||
@@ -36,24 +36,29 @@ | |||
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 | ||
48 | using namespace Opie::Core; | ||
49 | |||
50 | namespace Opie { | ||
51 | namespace Net { | ||
52 | |||
48 | /*====================================================================================== | 53 | /*====================================================================================== |
49 | * OPacket | 54 | * OPacket |
50 | *======================================================================================*/ | 55 | *======================================================================================*/ |
51 | 56 | ||
52 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) | 57 | OPacket::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 ) |
54 | { | 59 | { |
55 | //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); | 60 | //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); |
56 | 61 | ||
57 | _end = (unsigned char*) data + header.len; | 62 | _end = (unsigned char*) data + header.len; |
58 | //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); | 63 | //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); |
59 | 64 | ||
@@ -1335,13 +1340,14 @@ int OPacketCapturer::snapShot() const | |||
1335 | 1340 | ||
1336 | bool OPacketCapturer::swapped() const | 1341 | bool OPacketCapturer::swapped() const |
1337 | { | 1342 | { |
1338 | return pcap_is_swapped( _pch ); | 1343 | return pcap_is_swapped( _pch ); |
1339 | } | 1344 | } |
1340 | 1345 | ||
1341 | 1346 | ||
1342 | QString OPacketCapturer::version() const | 1347 | QString 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 | |||
@@ -55,26 +55,28 @@ extern "C" // work around a bpf/pcap conflict in recent headers | |||
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 */ |
63 | typedef struct timeval timevalstruct; | 63 | typedef struct timeval timevalstruct; |
64 | typedef struct pcap_pkthdr packetheaderstruct; | 64 | typedef struct pcap_pkthdr packetheaderstruct; |
65 | 65 | ||
66 | /* FORWARDS */ | 66 | /* FORWARDS */ |
67 | class OPacketCapturer; | ||
68 | class QSocketNotifier; | 67 | class QSocketNotifier; |
68 | namespace Opie { | ||
69 | namespace Net { | ||
70 | class 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. |
75 | * | 77 | * |
76 | * 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. |
77 | * 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 |
78 | * 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 |
79 | * encapsulates data from its upper layer - that is it | 81 | * encapsulates data from its upper layer - that is it |
80 | * 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, |
@@ -132,64 +134,72 @@ class OPacket : public QObject | |||
132 | 134 | ||
133 | void updateStats( QMap<QString,int>&, QObjectList* ); | 135 | void updateStats( QMap<QString,int>&, QObjectList* ); |
134 | 136 | ||
135 | private: | 137 | private: |
136 | 138 | ||
137 | QString dumpStructure() const; | 139 | QString dumpStructure() const; |
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 | ||
146 | QTextStream& operator<<( QTextStream& s, const OPacket& p ); | 151 | QTextStream& operator<<( QTextStream& s, const OPacket& p ); |
147 | 152 | ||
148 | /*====================================================================================== | 153 | /*====================================================================================== |
149 | * OEthernetPacket - DLT_EN10MB frame | 154 | * OEthernetPacket - DLT_EN10MB frame |
150 | *======================================================================================*/ | 155 | *======================================================================================*/ |
151 | 156 | ||
152 | class OEthernetPacket : public QObject | 157 | class OEthernetPacket : public QObject |
153 | { | 158 | { |
154 | Q_OBJECT | 159 | Q_OBJECT |
155 | 160 | ||
156 | public: | 161 | public: |
157 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); | 162 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); |
158 | virtual ~OEthernetPacket(); | 163 | virtual ~OEthernetPacket(); |
159 | 164 | ||
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 | ||
172 | class OPrismHeaderPacket : public QObject | 180 | class OPrismHeaderPacket : public QObject |
173 | { | 181 | { |
174 | Q_OBJECT | 182 | Q_OBJECT |
175 | 183 | ||
176 | public: | 184 | public: |
177 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); | 185 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); |
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 | ||
190 | class OWaveLanPacket : public QObject | 200 | class OWaveLanPacket : public QObject |
191 | { | 201 | { |
192 | Q_OBJECT | 202 | Q_OBJECT |
193 | 203 | ||
194 | public: | 204 | public: |
195 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); | 205 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); |
@@ -201,24 +211,26 @@ class OWaveLanPacket : public QObject | |||
201 | virtual OMacAddress macAddress1() const; | 211 | virtual OMacAddress macAddress1() const; |
202 | virtual OMacAddress macAddress2() const; | 212 | virtual OMacAddress macAddress2() const; |
203 | virtual OMacAddress macAddress3() const; | 213 | virtual OMacAddress macAddress3() const; |
204 | virtual OMacAddress macAddress4() const; | 214 | virtual OMacAddress macAddress4() const; |
205 | bool usesPowerManagement() const; | 215 | bool usesPowerManagement() const; |
206 | int type() const; | 216 | int type() const; |
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 | *======================================================================================*/ |
219 | 231 | ||
220 | class OWaveLanManagementPacket : public QObject | 232 | class OWaveLanManagementPacket : public QObject |
221 | { | 233 | { |
222 | Q_OBJECT | 234 | Q_OBJECT |
223 | 235 | ||
224 | public: | 236 | public: |
@@ -230,207 +242,231 @@ class OWaveLanManagementPacket : public QObject | |||
230 | int beaconInterval() const; | 242 | int beaconInterval() const; |
231 | int capabilities() const; // generic | 243 | int capabilities() const; // generic |
232 | 244 | ||
233 | bool canESS() const; | 245 | bool canESS() const; |
234 | bool canIBSS() const; | 246 | bool canIBSS() const; |
235 | bool canCFP() const; | 247 | bool canCFP() const; |
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 | *======================================================================================*/ |
248 | 262 | ||
249 | class OWaveLanManagementSSID : public QObject | 263 | class OWaveLanManagementSSID : public QObject |
250 | { | 264 | { |
251 | Q_OBJECT | 265 | Q_OBJECT |
252 | 266 | ||
253 | public: | 267 | public: |
254 | OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); | 268 | OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); |
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 | ||
267 | class OWaveLanManagementRates : public QObject | 283 | class OWaveLanManagementRates : public QObject |
268 | { | 284 | { |
269 | Q_OBJECT | 285 | Q_OBJECT |
270 | 286 | ||
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 | ||
283 | class OWaveLanManagementCF : public QObject | 301 | class OWaveLanManagementCF : public QObject |
284 | { | 302 | { |
285 | Q_OBJECT | 303 | Q_OBJECT |
286 | 304 | ||
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 | ||
299 | class OWaveLanManagementFH : public QObject | 319 | class OWaveLanManagementFH : public QObject |
300 | { | 320 | { |
301 | Q_OBJECT | 321 | Q_OBJECT |
302 | 322 | ||
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 | ||
315 | class OWaveLanManagementDS : public QObject | 337 | class OWaveLanManagementDS : public QObject |
316 | { | 338 | { |
317 | Q_OBJECT | 339 | Q_OBJECT |
318 | 340 | ||
319 | public: | 341 | public: |
320 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); | 342 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); |
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 | ||
333 | class OWaveLanManagementTim : public QObject | 357 | class OWaveLanManagementTim : public QObject |
334 | { | 358 | { |
335 | Q_OBJECT | 359 | Q_OBJECT |
336 | 360 | ||
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 | ||
349 | class OWaveLanManagementIBSS : public QObject | 375 | class OWaveLanManagementIBSS : public QObject |
350 | { | 376 | { |
351 | Q_OBJECT | 377 | Q_OBJECT |
352 | 378 | ||
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 | ||
365 | class OWaveLanManagementChallenge : public QObject | 393 | class OWaveLanManagementChallenge : public QObject |
366 | { | 394 | { |
367 | Q_OBJECT | 395 | Q_OBJECT |
368 | 396 | ||
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 | ||
381 | class OWaveLanDataPacket : public QObject | 411 | class OWaveLanDataPacket : public QObject |
382 | { | 412 | { |
383 | Q_OBJECT | 413 | Q_OBJECT |
384 | 414 | ||
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 | ||
397 | class OWaveLanControlPacket : public QObject | 429 | class OWaveLanControlPacket : public QObject |
398 | { | 430 | { |
399 | Q_OBJECT | 431 | Q_OBJECT |
400 | 432 | ||
401 | public: | 433 | public: |
402 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); | 434 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); |
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 | ||
415 | class OLLCPacket : public QObject | 449 | class OLLCPacket : public QObject |
416 | { | 450 | { |
417 | Q_OBJECT | 451 | Q_OBJECT |
418 | 452 | ||
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 | ||
431 | class OIPPacket : public QObject | 467 | class OIPPacket : public QObject |
432 | { | 468 | { |
433 | Q_OBJECT | 469 | Q_OBJECT |
434 | 470 | ||
435 | public: | 471 | public: |
436 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); | 472 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); |
@@ -440,69 +476,75 @@ class OIPPacket : public QObject | |||
440 | QHostAddress toIPAddress() const; | 476 | QHostAddress toIPAddress() const; |
441 | 477 | ||
442 | int tos() const; | 478 | int tos() const; |
443 | int len() const; | 479 | int len() const; |
444 | int id() const; | 480 | int id() const; |
445 | int offset() const; | 481 | int offset() const; |
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 | ||
458 | class OARPPacket : public QObject | 496 | class OARPPacket : public QObject |
459 | { | 497 | { |
460 | Q_OBJECT | 498 | Q_OBJECT |
461 | 499 | ||
462 | public: | 500 | public: |
463 | OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); | 501 | OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); |
464 | virtual ~OARPPacket(); | 502 | virtual ~OARPPacket(); |
465 | 503 | ||
466 | QHostAddress senderIPV4Address() const; | 504 | QHostAddress senderIPV4Address() const; |
467 | OMacAddress senderMacAddress() const; | 505 | OMacAddress senderMacAddress() const; |
468 | QHostAddress targetIPV4Address() const; | 506 | QHostAddress targetIPV4Address() const; |
469 | OMacAddress targetMacAddress() const; | 507 | OMacAddress targetMacAddress() const; |
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 | ||
482 | class OUDPPacket : public QObject | 522 | class OUDPPacket : public QObject |
483 | { | 523 | { |
484 | Q_OBJECT | 524 | Q_OBJECT |
485 | 525 | ||
486 | public: | 526 | public: |
487 | OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); | 527 | OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); |
488 | virtual ~OUDPPacket(); | 528 | virtual ~OUDPPacket(); |
489 | 529 | ||
490 | int fromPort() const; | 530 | int fromPort() const; |
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 | ||
503 | class ODHCPPacket : public QObject | 545 | class ODHCPPacket : public QObject |
504 | { | 546 | { |
505 | Q_OBJECT | 547 | Q_OBJECT |
506 | 548 | ||
507 | public: | 549 | public: |
508 | ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); | 550 | ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); |
@@ -513,47 +555,51 @@ class ODHCPPacket : public QObject | |||
513 | QHostAddress serverAddress() const; | 555 | QHostAddress serverAddress() const; |
514 | QHostAddress relayAddress() const; | 556 | QHostAddress relayAddress() const; |
515 | 557 | ||
516 | OMacAddress clientMacAddress() const; | 558 | OMacAddress clientMacAddress() const; |
517 | 559 | ||
518 | bool isRequest() const; | 560 | bool isRequest() const; |
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 | ||
531 | class OTCPPacket : public QObject | 575 | class OTCPPacket : public QObject |
532 | { | 576 | { |
533 | Q_OBJECT | 577 | Q_OBJECT |
534 | 578 | ||
535 | public: | 579 | public: |
536 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); | 580 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); |
537 | virtual ~OTCPPacket(); | 581 | virtual ~OTCPPacket(); |
538 | 582 | ||
539 | int fromPort() const; | 583 | int fromPort() const; |
540 | int toPort() const; | 584 | int toPort() const; |
541 | int seq() const; | 585 | int seq() const; |
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 | *======================================================================================*/ |
554 | 600 | ||
555 | /** | 601 | /** |
556 | * @brief A class based wrapper for network packet capturing. | 602 | * @brief A class based wrapper for network packet capturing. |
557 | * | 603 | * |
558 | * This class is the base of a high-level interface to the well known packet capturing | 604 | * This class is the base of a high-level interface to the well known packet capturing |
559 | * library libpcap. | 605 | * library libpcap. |
@@ -656,16 +702,20 @@ class OPacketCapturer : public QObject | |||
656 | 702 | ||
657 | protected slots: | 703 | protected slots: |
658 | void readyToReceive(); | 704 | void readyToReceive(); |
659 | 705 | ||
660 | protected: | 706 | protected: |
661 | QString _name; // devicename | 707 | QString _name; // devicename |
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 | |||
@@ -22,24 +22,29 @@ | |||
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 | #include <opie2/ostation.h> | 31 | #include <opie2/ostation.h> |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | |||
35 | using namespace Opie::Core; | ||
36 | |||
37 | namespace Opie { | ||
38 | namespace Net { | ||
34 | /*====================================================================================== | 39 | /*====================================================================================== |
35 | * OStation | 40 | * OStation |
36 | *======================================================================================*/ | 41 | *======================================================================================*/ |
37 | 42 | ||
38 | OStation::OStation() | 43 | OStation::OStation() |
39 | { | 44 | { |
40 | odebug << "OStation::OStation()" << oendl; | 45 | odebug << "OStation::OStation()" << oendl; |
41 | 46 | ||
42 | type = "<unknown>"; | 47 | type = "<unknown>"; |
43 | macAddress = OMacAddress::unknown; | 48 | macAddress = OMacAddress::unknown; |
44 | ssid = "<unknown>"; | 49 | ssid = "<unknown>"; |
45 | channel = 0; | 50 | channel = 0; |
@@ -53,12 +58,15 @@ OStation::~OStation() | |||
53 | odebug << "OStation::~OStation()" << oendl; | 58 | odebug << "OStation::~OStation()" << oendl; |
54 | } | 59 | } |
55 | 60 | ||
56 | 61 | ||
57 | void OStation::dump() | 62 | void OStation::dump() |
58 | { | 63 | { |
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 | |||
@@ -31,43 +31,52 @@ | |||
31 | #ifndef OSTATION_H | 31 | #ifndef OSTATION_H |
32 | #define OSTATION_H | 32 | #define OSTATION_H |
33 | 33 | ||
34 | #include <opie2/onetutils.h> | 34 | #include <opie2/onetutils.h> |
35 | 35 | ||
36 | #include <qlist.h> | 36 | #include <qlist.h> |
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 | ||
43 | namespace Opie { | ||
44 | namespace Net { | ||
45 | |||
43 | class OStation; | 46 | class OStation; |
44 | 47 | ||
48 | |||
45 | typedef QList<OStation> OStationList; | 49 | typedef QList<OStation> OStationList; |
46 | 50 | ||
47 | /*====================================================================================== | 51 | /*====================================================================================== |
48 | * OStation | 52 | * OStation |
49 | *======================================================================================*/ | 53 | *======================================================================================*/ |
50 | 54 | ||
51 | class OStation | 55 | class OStation |
52 | { | 56 | { |
53 | public: | 57 | public: |
54 | OStation(); | 58 | OStation(); |
55 | ~OStation(); | 59 | ~OStation(); |
56 | 60 | ||
57 | void dump(); | 61 | void dump(); |
58 | 62 | ||
59 | /* Ethernet */ | 63 | /* Ethernet */ |
60 | QString type; | 64 | QString type; |
61 | OMacAddress macAddress; | 65 | OMacAddress macAddress; |
62 | QHostAddress ipAddress; | 66 | QHostAddress ipAddress; |
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 | ||